Since the beginning of the theory of evolution, there has always been an attitude that we can guess what sorts of qualities will be favoured by evolution. It has been assumed that things that are stronger, faster and smarter are favoured. It has been assumed that things that are more selfish will be favoured.
In The Universe in a Single Atom the Dalai Lama muses that altruism cannot be explained by evolution alone. This view is an echo of what learned scientists who study evolution have told him.
But if evolution favours selfishness over altruism, then why aren't the cells in your body fighting it out with one another right now? Our cells don't eat each other the way paramecia do. That is because cooperation is better than defection. If cooperation were a failure, we would be paramecia at best, but it seems more likely we would be nothing at all.
Of course genes don't just create cells or organisms, they create groups of organisms. Yes, I have different DNA than you, but each of your chromosomes has different genes than the others. Collectively human DNA creates a wide variety of humans, and we to have evolved to work together. Examine the brain of a feral child, one that has grown up without contact with other humans and you find holes there; places where nothing grew because there was no stimulation for it. We are designed to care about each other. We are designed to sacrifice ourselves for each other if necessarily.
It makes perfect sense that evolution would create these traits. These traits are better than selfishness. We don't call it the tragedy of the commons because everything works out great for everyone. Selfishness is shit, we all know it, an evolution knows it too
1.
1. I know that evolution doesn't know anything.