If you aspire to work at FAANG and fail you can be a software developer somewhere else. If you aspire to be a doctor and aren't admitted to med school, those years of education, volunteering, shadowing, test prep, etc. are fairly useless.
And even if you succeed, the hours are as bad as can be and the pay isn't much better than FAANG. It's not a logical choice unless you really want it, while software dev is (was?) a great career choice even if you don't care about software.
For all these reasons, a lot of people are filtered out long before applying to med school.
It’s more selective. So comparing FAANG salaries to the average doctor salary isn’t useful. To find something equally selective, you’d need to pick a higher paid subset of doctors.
In the same way, there are many filters before filling out a med school application.
Anyway I can't see any way anyone could believe the "median software developer" writing CRUD web pages or in-house apps is comparable to the average physician.