Damian Counsell, in an excellent post exploring learned responses to human difference, notes that ”humans are naturally disposed to discriminate against members of other tribes."
I think that's right.
And as Damian says, understanding the basis of prejudice doesn’t excuse racism, it allows us “to acknowledge our flaw, resist its effects, and build a world where those who express it are put at a disadvantage.”