Contradictory behaviour is what all humans engage in. It’s “irrational”, if that’s how you want to label it, but the label doesn’t really get you anywhere. Like all labels.
Racism is a “reasonable response” in the sense that it derives from reason that is attached to a particular perception of the world. What, you think that it just randomly hits somebody’s brain some day to hate immigrants, with no reason at all?
This is why the contemporary left ends up going in circles so often. It would rather label socially-destructive behaviour as the actions of the irrational and unreasonable other, an inhuman and illiterate lump of sub-humans, than engage with the psychological, sociological, political and economic processes that produce particular ways of seeing the world — the “reasons”, if you like. In a funny way, it really is just the mirror image of what the other side are doing — label the other and fear them.