There is widespread public consensus that it is immoral to judge people based on immutable traits. Just look at the way "sexist", "racist", and "homophobe" are used and you see what I mean.

There is also widespread public consensus that it is moral to judge people based on their beliefs. Just look at the way "communist" and "fascist" are used to see what I mean.

It seems to me there is a contradiction here. I don't think anyone chooses their beliefs. Belief is something that happens to you, you are convinced. I mean just try to sincerely believe 2+2=5. It can't be done. So to me, belief seems like an immutable trait as well.

Am I missing something, or is this cognitive dissonance?