I think that bias, hence racism, is part of human nature. We want the best for our own small group but want to keep others from accessing what we have (because self-esteem and happiness is relative to others). I can image a white family being biased against Blacks. But if a daughter marries a black man, and has children with him, than the attitudes will change.
That type of human bias is plainly obvious when you look at criminal law. Most voters support very tough penalties for criminals. But if one of their children commits a crime, they’ll plead for clemency, arguing that kid is a very good person who was influenced by “bad” people (ie other people’s kids)
I think that deflection is a human survival instinct. If one looks in the mirror and the only thing one sees is ugliness, then there’s no reason for living and reproducing.
Now, truly civilized and compassionate people recognize the bias and work to end it.