Racism, bigotry and xenophobia are immoral, of course, but they are also, just as fundamentally, untrue. They areunreal. They provide a theory and a framework for living in the world that cannot be reconciled with the reality of this world. The person who chooses to accept that unreal framework is thus constantly forced to choose between unreality and reality, between the theory and the facts. To hold onto the unreal framework, they must continuously reject reality. And every time they do that, they get a little bit dumber.
It's an interesting point, but I'd push back on it in two ways.
First, I think it's easy to overestimate the correlation between bigotry and stupidity. I think we're drawn to examples of particularly stupid people among our ideological opponents (a group that includes the bigots, if we're anti-bigotry). Those people are easy to rebut -- indeed, their claims may be patently self-refuting. So we get the thrill of establishing the superior merit of our ideas, coupled with the communal activity of gathering together to mock someone we can all agree is hopelessly wrong. And they make great propaganda for our side -- look at what morons the other side is! On the other hand, the stupidest of our enemies are fascinating because of our failure to rebut them. Their stupidity is so obvious that we know that were we to make these refutations to their face, they wouldn't budge, because their ideology is in the grip of something divorced from logic. So we worry at them ineffectually. The upshot of all this is that we're subject to a strong availability bias when thinking about how stupid bigots are.
Second, I think the very unreality of bigotry's claims can require intelligence as easily as it can require stupidity. When you encounter contradictory information, you can take the stupid route and just tune it out. Or you can take the intelligent route* and find a clever way to integrate it without disturbing the core of your belief system. The worse your bigotry, the worse its clash with reality, and therefore the more mental gymnastics you have to execute to keep the latter from exploding the former. I suspect this is why we so often find ourselves saying "how could someone so smart believe something so stupid?" Perhaps, for example, a somewhat lesser mind than Isaac Newton's would not have been able to maintain the plausibility of astrology.
*You could argue that this kind of "mere cleverness" is not intelligence in the real sense of being the opposite of stupidity, but I think that route leads quickly to the No True Scotsman fallacy.