Comparing plumbers to pilots to lawyers as systems to restrict access to employment is conflating completely different systems. The closest comparisons I see to pilot's licenses are CDL's and professional engineering licenses. In those cases, the basic purpose is to make sure there is a basic level of training, experience and knowledge to complete a task without killing people, more or less. Even those are a little different, as the last time I checked it was a bit tricky to get an actual engineering degree without attending a brick and mortar college, similar to a law degree, and that may have started out as a method to limit entry into the field. But that hasn't been all that effective, because even though I do have many lawyer friends, I don't think anyone would say that we have a lawyer shortage.
Plumbers, carpenters and electricians go back further, and that's the trades and guilds. Probably most people on here know those better than I do, but the basic premise there was to promote, not restrict, skills of a particular trade, and to have a standard way to teach and promote those skills. The opposite of being restrictive. Hundreds of years ago, they were smart enough to realize that education and sharing of skills was a way to improve their wages and along the way make the world better.
The concept of privilege is tossed around a lot these days, but it's been my experience that most of the time it's earned, or not, along with success.
As to pilots, all joking aside, one of the kindest guys I ever knew was a professional pilot. To someone that would say "pilots are XXXX" in a serious tone, I'd ask if they would be comfortable making the same statement about someone based on their color of their skin or their ethnic background. It's not quite the same, but categorizing people, putting a label on them, and judging them is one of the weaker things that we do as a species. Ok, soapbox down...and yep, I did pick on lawyers above. Sometimes I'm a bit hypocritical.