We (the human species) worked out a long time ago how best to get by in the world. And the theory is tantalizingly simple. It's the practice that's a bitch.
We can quibble over who really said what (and when), but all the major religions and schools of ethical thought (and many of the minor ones) have come to a similar conclusion about the best way to live. Unfortunately, most of them didn't stop at the Golden Rule, but instead tacked on a lot of other junk about diet, fashion, and hygiene; because, let's face it, it's so much easier to dress correctly than it is to be empathetic to another human being.
There are some who have suggested that the propensity to think of others helped to spur human evolution. And there's certainly a case to be made that those who practice kindness were more likely to survive (and thus pass on that trait). It's an interesting hypothesis, but it seems a bit of a stretch to me, since we are one of the few species who kill and abuse our own kind. Animals (at least within their own species) don't really seem to have a need for the golden rule. In any case, humans probably did recognize early on that constant retaliation rarely solved anything in the long run.
Of course, there is certainly room for debate as to whether being "good to others" really is a rational strategy. And in our current geo-political climate, we're not likely to agree anytime soon. But interestingly enough, even game theory suggests that the best way to "get along" is to lead with kindness and then respond in direct proportion to how the other "player" reacts. Of course this strategy can still lead to a spiral of violence, for which game theory suggests that a re-set can be advantageous. That is, try leading with kindness again. You can sometimes catch your opponent off guard.*
For those you you who may not know, my depiction of Mohammed in shadow is not intended as a slight. Orthodox Muslims consider it sacrilegious to display images of the prophet Mohammed. (Hey, it's no crazier than that thing you believe.) And it seems to me if I’m going to be admonishing people about the golden rule, I should probably “do unto others…” myself.
* Game Theory is useful to understand even for everyday (non-game) interactions. For an excellent and reader-friendly book on the subject, check out Rock, Paper, Scissors: Game Theory in Everyday Life by Len Fisher.