Tribal behavior is an ancient evolutionary trait. By definition, a human tribe recognizes descent from a common ancestor. From this recognition, rules of membership are created. As populations grow and genetic distance evolves, the tribe becomes wholly metaphorical.
At the metaphorical level, tribalism is realized in religion, nationalism, and racism.
Tribal myths of origins are distributive memories of existence that substantiate the rules that separate tribes.