I'm not sure I'd say it is always irrational, given non-omniscient thinker.
For instance, consider encountering a goblin. Before they could become visitors, in fort mode it'd almost always mean that you're looking at snatcher, ambush, siege, noble or a gosling. A player is likely to be prejudiced against a swarm of "g"s in a way they're not against a swarm of "d"s - may ignore the latter, even, while the first is going to get looked at or viewed when first seen. Maybe their heart will even race when seeing what might be a macegoblin next to fisherdwarf.
"But hey, you don't know these gs are out to kill your fortress, why are you treating them so differently from ds, it's unequal treatment you letterist" is not going to convince any player who has had lost a fort to 100 goblins coming in, and 100% of them engaging in killing their fort to death. In fact, I'm left a little askance for a way to claim it to be irrational prejudice.
As for the visitors, in adventure mode there's also the matter of their native KILL_NEUTRAL:REQUIRED ethics, which leads to some goblins being mandated to stab outsiders to the face. It's perhaps prejudiced for players to engage in information gathering before marching up to a goblin, but after they lost their previous adventurer to a sharp retort they'll be probably bit more suspicious of people who could have current ties to goblin civilization.
(Of course, there's also many adventure mode stories where the adventurer attacks or kills someone they shouldn't have, who wasn't hostile to them, which is letting the prejudice override more normal course of action to the point of irrationality.)
Now, this topic was about NPC-NPC interactions, not player foibles, lucky charms and "just so happens to do the right thing" dances. But for above, NPCs are much less able to gather information without engaging than players are.