Honest question: Is this a common function of a union? For instance, I don't seem to recall hearing much about auto-workers taking ethical stances and being protected from termination by their union. But it's also not something I've paid much attention to, so maybe this is indeed something unions do. I'm genuinely curious.
Historically yes it is a massive part of what unions have done and continue to do. For example there have been many examples of dock workers refusing to transport South African or Israeli goods. That this is done as a collective action organised by union is what protects workers from individual retaliation.