Well, it’s not quite typical. But the mechanism is common and simple. This is a psychological defense (against anxiety, fear, pain about one's imperfection), which is called "projection."
In general, all people really project - not all of them take on such very vivid forms as you described.
Everything is simple there. A person is afraid of something deep in his soul about himself. Not the fact that this is really so about him, the fact is that it is mortal, panicky afraid that this is so or may become so under some conditions. For example, that I am a fool, or that I am not courageous enough ("not a man"), or that I am an aggressive egoist. Then - one-two-three!
One is repression: a terrible thought about oneself is displaced into the unconscious.
Two is a projection: it is like a hot potato thrown onto someone in a personal or business environment.
Three - exposure: in the eyes or behind the eyes, the "target" of his projection, a person begins to expose, in the eyes or behind the eyes.
She is a fool! (and I, by definition, then smart!)
He - P ..... S! (and I, you see, a real man!)
They are generally Pindos and want to take over the whole world, and only me, d Artagnan in a white cloak ...
Well, that is, the world becomes black and white, and this is actually a lot of relief: the more I scream that these, those and those are black, the more I (and the rest, the rest, huh ?!) it is clear that I, who so gloriously denounces them, is white.
So, for example, among the Nazis and racists, I would reasonably suspect the fear of a low, unworthy origin ... well, or simply of my insignificance. - This is not the only possible reason, but I think it is very frequent and well reinforcing any others.
Well, just, if your boss constantly scolds you as a fool, take a notebook and write down: "NN is afraid that he lack of intelligence. " Very educated guess)))
This comes from psychology (social identity theory, Henry Tashfel). In a nutshell, people divide the world into "we" and "they", and then, to raise self-esteem, discriminate against "them".
If a person does not represent anything interesting, then he cannot present himself as something outstanding. He just has nothing to say. Thus, the best way to show yourself "good" is by showing how bad others are in comparison.