The problem of evil is a good question but it is hard to answer. However, this question lies at the heart of Rousseau's and Kant's philosophies (and everyone else who were inspired by them). Earliest form of game theory dealt exactly with the question of cooperation. Since both Rousseau and Kant are extremely religious, the game theoretic approach is used to explain why we should cooperate (but later forms started arguing for doing exactly the opposite). You might enjoy reading Rousseau's and Kant's works if you want to start from somewhere and I will provide a summary of what they said in case you want to check it out.
Rousseau basically says that socialization corrupted our soul and the civilized men can turn on and off their pity/compassion, as opposed to natural men (mostly indigenous communities) and animals. Civilized men act the way you described due to amour-propre which originates in one of the historical stages that Rousseau describes in Discourse in Inequality. Amour-propre is arrogance/vanity and it is the root of evil in civilized communities unless it is trained. As opposed to amour de soi (which is basically preserving the self or SI within the context of this forum), amour-propre makes comparisons and tries to seek confirmation from others. Rousseau suggests two solutions: the first one is establishing direct democracy in which everyone surrenders themselves to the state (which is explained in Social Contract) or through the educational model that he proposes in Emile. However, Rousseau is a fanatic Christian and he sees existence as some sort of a game that God has created. God is training us (or white civilized European men to be more precise) in the same way a parent raises his children. Hence, the game theory is mainly used to portray God's morality. We behave wicked because we have not reached the ideal society yet.
Kant's arguments are generally hard to decipher but I will share my own interpretation of it. Kant, in his third Critique, answers a central philosophical question which Leibniz was also interested in: "Why is the Universe as it is?". Similar to Leibniz, the rationale is because this Universe is the only one that makes God valid for us. Clearly, his argument is extremely detailed and it is hard to capture all the points here. I will skip his ideas on universality of aesthetic judgement and the validity of categories and causal relationship for the human mind which actually is the core of his argument for God but they are long. Kant finds God in the intersection of morality with the physical world. He says that physical/mechanical world could indeed came from randomness but the way our behaviours play out in the physical world cannot be explained with randomness and mechanical principles alone. Our behaviours and the end that we set for ourselves make the highest good on Earth valid for us. (I should warn you beforehand that following is mostly my interpretation of Kant) To make this more concrete, everyone including those wretched politicians want to be "happy" in Aristotelian sense. That is everyone is aiming for the highest good at the individual level. However, this world is structured so that the highest good at the individual level cannot be realized before the highest good at the societal level is realized. The reason is exactly you. Because we are created so that morality is universal since we have a compassion faculty (Kant actually mentions this part). Hence, it is not possible to be truly happy unless enough number of people are happy. Otherwise, we will feel sorry for those who suffer due to injustice. This is also why wretched politicians keep trying to hide their crimes because they know very well that their behaviours are not acceptable because morality is universal and they have compassion. Kant does not offer a solution to this in the same way that Rousseau does but his idea is basically we will reach the highest good on Earth through trial and errors. Eventually people will realize that cooperation is better than Nash-equilibrium. Currently, we are actually going down this route due to environmental crisis. That is either we cooperate and build a better world or only the isolated primitive communities continue to live approaching the ideal society.
To sum up, Rousseau would answer you with noting that because God is testing us this way since he wants the best for us. And Kant would answer you that because eventually we will learn to act better and we are simply trying to turn the world into paradise. My answer is non-existent as of yet but if I have one, I will definitely share it with you.