I don't think doctors are a useful analogy for software developers. You mention doctors, then people are going to say "we need licensing for software developers" (which for the majority of programming jobs is silly IMO), and the conversation goes off the rails. Doctors are an unusual profession, leave it at that.
plumbers, electricians, civil engineers, architects, structural engineers, etc. All these occupations have licensing requirements. Why is software different?
Software is generally rather ephemeral and without a code to write or build to. We have "best practices".
Yes, some software is built under engineering assumptions - airplane software, etc. NASA has a standard they write code to and software engineers are expected to work within these confines. Part of the code requires reviews of written software, etc. [1]
[1] https://sma.nasa.gov/sma-disciplines/software-assurance/2019...