But let's run with that freedom of speech argument, shall we? Because it does sound just vaguely plausible that if a biology professor is denied tenure for teaching creationism or a nurse is fired for refusing to be vaccinated, you could say they're being punished for their beliefs. After all, losing a job or benefit for what may well be a deeply held belief can certainly be framed as a violation of their right to free speech or conscience. Freedom of speech is in fact quite relevant here. It's just that it's not the speech of the biology professor or nurse.
It's the speech of the certifying body. See, when you're licensed to practice medicine (or law or any other regulated profession), the regulating body that grants you that license or certification is, in effect, vouching for you. They are saying, "This person knows what they're talking about in the subject area, and we stand by their professional judgment." They are endorsing you.
Now, you don't actually have any right to that endorsement. You have to qualify. You have to earn their confidence and maintain it, and if they ever lose confidence in your competence, they are absolutely entitled to withdraw their endorsement. Indeed, I'd say they're obligated to do so.
So if a doctor starts spouting conspiracy theories about vaccines, and has their license revoked as a result, they might well feel like they're being punished for their beliefs and their freedom of speech is being violated. But it isn't. They're still completely free to express those opinions. They just don't get to claim the authority of the certifying board is behind them if they do so.