As mentioned, the “insult” often happens when people are trying to be good people. They slip out although they have good intentions, trying to be polite:
One of the reasons it’s so easy to slip out when people have good or benign intentions is that we all have unconscious (or implicit) biases. There are assumptions and expectations that we hold about certain groups of people without even necessarily being aware of it.