I don't think it's a good idea to require licensing for most software engineers, but I think this specific concern is not actually a significant issue.
1) Quite simply, software is much easier to learn than medicine, so you have a larger supply of capable software engineers than doctors. If the market for their services is being artificially suppressed, they will gravitate to wherever their services can make money.
2) There is a black market for medical services. Ever heard of a back-alley abortion?
The black market for exploits is already very lucrative. Devs willing to take that money are probably doing so already.
> There is a black market for medical services. Ever heard of a back-alley abortion?
Back alley abortions exist mostly because of restrictions on legal abortions, not because doctors aren't allowed to practice without license.