Here’s a very concrete example of how ethnocentrism can evolve. The Batwa Pygmies of Africa’s Great Lakes region are a small population numbering only about 80,000 people. Their future is at risk because their traditional way of life has been destroyed and they are often hunted by other Africans.
Now let’s say a mutation randomly appeared in the Batwa Pygmies causing ethnic loyalty. Let’s say it was extremely rare, and only 0.01% of the 80,000 Batwa Pygmies had it (8 individuals). Now suppose one of these 8 individuals was intelligent enough to become a globally famous civil rights activist, winning the admiration of president Obama and giving speeches to the American congress, and inspiring them to send financial aid and military support for the Batwa Pygmies. As a result of this assistance, the Batwa Pygmy population quadrupled from 80,000 people to 320,000 people. Still only 0.01% of the Batwa pygmies had the ethnocentric mutation, but because that mutation caused the overall Batwa pygmy population to grow, now there were 32 ethnocentric mutants, instead of 8.
Now let’s say the 320,000 population split in half, and all 32 of the ethnocentric mutants were in one half. The half with the ethnocentric mutants continued to get protection from the United States because of the strong activism from a few of the ethnocentric mutants, but the half that didn’t was slaughtered by other Africans. Now the overall population of Batwa pygmies has shrunk to 160,000, but the percentage that have the ethnocentric mutation has increased from 0.01% to 0.02% because all 32 of the mutants were in the half of the population that didn’t get slaughtered.
Now let’s assume that some of the ethnocentric mutants use the fact that half the Batwa pygmy population was slaughtered to lobby for even more support from America. The population quadruples again but this time from 160,000 to 640,000, but now the ethnocentric mutants are 0.02% of the population, so their numbers jump from 32 to 128. Now let’s assume the population splits again, and the half without the ethnocentric mutants gets slaughtered again. Now the ethnocentric mutants are 0.04% of the surviving Batwa pygmies.
So as we can see, over evolutionary time, the number of genetically ethnocentric people increases, especially in absolute numbers, but even as a percentage of their ethnic group.
And all of this ignores the individual fitness benefits that likely accrue to the ethnocentrics. Because they saved their people from extinction, they and their closest kin would likely be lionized by the Batwa pygmy community and showered with numerous sexual partners, have a great many children, who themselves would likely be protected by the Batwa community. As a result of all this goodwill, the ethnocentric gene could spread far more rapidly than my example implies. Indeed all through history, warriors and activists who fight for their people have been elevated to God-like status.