The concept appears in all major world traditions: Islam, Buddhism, Hinduism, Taoism, Judaism, Christianity, Zoroastrianism and still others. A form of the Golden Rule is fond in almost every culture.
The idea to treat others as you would like to be treated is, when examined closely, a very selfish concept which probably found its origin in the distant past when it was realized that, if one wanted to live peacefully in the tribe, it would be a very useful concept. All tribal rules, including localized concepts of morality, could stem from that concept, which is all compassing and does not rely on any “god” to be enforced but rather through the local tribe’s concept of morality.
The variations in the different traditions are obviously similar. Some traditions include:
“What you hate to be done to you do not do to another” (Egyptian)
“Do not do to others what you know has hurt yourself” (Tamil)
“One should never do something to others that one would regard as an injury to oneself (Sanskrit)
“Avoid doing what you would blame others for doing” (Ancient Greece)
“Treat your inferior as you wish your superior would treat you” (Ancient Rome)
“What you do not wish for yourself do not to others” (Confucianism)
This one “moral” seems to be the base upon which all other tribal rules were built. It was necessary to enforce the concept. This rule applied to everyone, theist or atheist. It has arisen during human evolution as a concept that has been very beneficial to the only hominid genotype which skirted extinction. The rule seems to still be applied in modern human societies. Humanism has also adopted the “Do Unto Others” concept as applicable to all humankind. For versions of the Golden Rule, not a single one of these versions requires a god or any similar supernatural entity.