They treat a human or an elf or another dwarf in exactly the same way as they would a goblin, provided that they come from that particular hostile civilization.
This is impossible and irrelevant until you explain to us how a dwarf has any idea what civilization a visitor is from aside from race in a split second from 30 yards away, when nobody wears identifying images on their clothing.
Large tattoos? Posturing? Maybe everyone in the DF universe is polite enough to announce their intent. Explain how they can tell a force composed entirely of abducted dwarves, humans, and/or elves is from a hostile goblin civilization?
First, you have to establish first that this ever actually happens to begin with (all abductees, none of whom are from your fort by the way) -- Toady might have controls set on how many abductees can be involved proportionally. If so, then you could always tell racially by their goblin compatriots or that it's your previously abducted colleague.
They don't have tattoos, cause it already describes their individual nose hairs pretty much, and that would be an absurd omission. Posture is possible, but is a much weaker explanation -- people getting hugged or slaughtered routinely based on whether they happen to be standing a slightly different way... would be a pretty dumb system when a much much more reliable racial cue is available. Why would you not use the most obvious information? (and note: if they use both at once, they're still being racist)
The same way the player knows the given name of every Goblin invader the moment it steps onto the map.
The player is not the same as creatures. I know that so-and-so is a vampire, for instance, it tells me when he is active, but my dwarves don't until he is witnessed and prosecuted. Nor do they know they've pathed right through a GCS until they get there. You cannot assume knowledge fromk one to the other.
So no, you need independent information to establish that this is how dwarves do it. And no, getting the C++ object passed does not count, if they are programmed to ignore it, then in game storyline terms, they don't know it at all / don't see it.