It appears to me that law and medical licensing bodies are advocates for the public against the professions. It may be incidentally beneficial to the professions in some ways (trust, etc) but the same can be said of environmental and safety regulators (accidents cost time, etc).
In what sense are they unions?
"Software engineers need to be protected from the employers" and "the public needs to be protected from software engineers" seem like very different positions, in fact I can imagine both organizations existing in a sometimes-adversarial relationship.
They are unions in the sense that they draw their funding from membership fees, set high entry standards that keep competition in check for existing members (obviously there are altruistic reasons for this too, but one impact of requiring a long, expensive degree is low competition). The union structures in medicine and law and piloting tends to favor established members over new ones.
IMO setting high standards is a quality shared by any healthy industry, because permitting shoddy work means every consumer needs to learn the details of the task in order to judge their provider.
In the context of this thread, it seems very much to be the case of "the public needs to be protected from software engineers." The N'th ancestor post very explicitly says that "we" are causing this problem.
The idea being, if professional strictures were imposed upon us, that would give us a stronger ability to push back against those who set tasks in conflict with those strictures.
In what sense are they unions?
"Software engineers need to be protected from the employers" and "the public needs to be protected from software engineers" seem like very different positions, in fact I can imagine both organizations existing in a sometimes-adversarial relationship.