"Racism" is just a subset of social sensitivities that are a basic part of human nature.
Human beings are highly sensitive to tiny social cues of the social position of other people which people try to read based on all sorts of clues like sex, age, clothing, wealth, use of language, cultural or geographical origin, skin color and so on. Most of these distinctions are not rational to begin with and you can't stop people from making social distinctions just by pointing out that they are irrational.
Already in this thread, people have given enough social clues about themselves to cause other people in the thread to hate them for belonging to what they perceive as a different social group.
You can make discrimination based on race illegal and create social taboos against treating people different based on their race but turning off the underlying social perception is an uphill struggle against human nature.