There are reasons that favor occupational licensing. Consider, for instance, Electricians. There are standards which exist based on past failures, a sort-of institutional learning.
I'll admit that it can be annoying when the inspector fails your self-installation because "it is not up to code". It feels like a sneaky way to enforce hiring an electrician. It is also annoying that a vet can't practice on humans. I doubt that I'm much more complex than my cat.
On the other hand, licensing keeps me from performing brain surgery on you during the weekend. Unlicensed people don't know the "institutional learning", so they are likely to repeat potentially fatal mistakes. Medicine is sufficiently complex that one person can't know it all, or even other specialties.