As we developed polities, economies, empires, and civilizations we cooperate in greater numbers, with greater anonymity, first across families, then tribes, then nations, and then races.

People in every region, in every race, in every era act POLITICALLY as a group even if they act pragmatically when acting individually in daily life.

The more possible it is to use political, economic, or military power to increase status for a group, the more likely it is to cause racial tensions.

Those states that have been most successful at minimizing racial and tribal tensions have been those that preserve majority control of political, economic, and military institutions such that while people may cooperate as individuals, they cannot compete as groups.

https://www.quora.com/How-does-civilization-lead-to-racism