@garbados The solution for this specific issue is a professional body, not a union. Most other professions (e.g. engineers, nurses) require licensing from one or more such bodies. This license is a double edge sword. On the one hand only a licensed engineer can stamp a design, and only a registered nurse can administer specific medicine. On the other, if a stamped design fails, or a nurse kills someone, that individual is at fault.
@garbados In this example, to implement the evil thing in the first place would require an individual with a license. And if that evil thing killed someone, the licensed individual who implemented it would be at fault.