Unions & guilds also serve to keep other workers out
There are laws that work has to be assigned to union shops, etc
There are laws that work has to be assigned to union shops, etc
The other side of the same coin is, for example, ISP local monopoly laws.
The point is that the mere existence of a union is not a sufficient condition for union-only laws; unions exist in places where such laws don't exist. As an argument against unions this is a slippery slope fallacy.