Doctors and lawyers can't engage in their profession since the age of 10 or so, like programmers can.
Doctors generally cannot be self-taught like programmers (what practice surgery on a neighbor?).
Programmers can literally envision things in their minds, and then make them come to life after putting hands on keyboard -- there's no effective equivalent in medicine and law. (Biology/biochem/chem, sure.) Also doctors and lawyers have to be accredited by a government board at least at the state level, programmers do not. Doctors and lawyers generally have to spend (or go into debt for) 10's to 100's of thousands of US dollars before being officially allowed to practice in their field -- programmers do not. And in general, the cost of mistakes in programming are small, with no lives or fortunes at stake (in the general case.), unlike law and medicine. Lastly, from what I can tell, in the US the average programmer will make anywhere from 1/2 to more likely 1/10 what a lawyer or doctor will make in their respective careers.
There are many differences between the professions of programming, medicine and law. So it's hard to make sweeping generalizations and use that to draw definitive conclusions.
Programming is very different.