To underscore this, take someone who goes straight through: finish undergrad at 22, med school at 26, internal medicine at 29, cardiology at 33. Again, no gap year, no research, certainly no PhD. At age 33, this person will have enough income to start making meaningful payments toward their debt, rather than just paying subsidized interest. It would be near-heroic to pay this off before 40 unless they were in private practice in the Midwest. And this is the best possible case: shortest training time, lucrative specialty, private practice.
In addition to all the debt you rack up, finishing your schooling in your 30s represents a huge opportunity cost - in the US a software developer with a BS has grossed something like a million dollars by then.
The US actually does subsidize the training of doctors, to the tune of tens of billions of dollars per year through Medicare alone.
That said, most people don't realize how heavy of a debt load doctors carry. Doctors reported incomes are much larger than their actual take-home pay due to things like malpractice insurance, which means that in the end, it's not unusual for a doctor these days to plan to make their last payment on these loans in their forties.
Put another way: most doctors are literally past what is thought of as childbearing age by the time their "investment" has broken even, and that's not even counting things like a mortgage, etc. that many people would want to have when starting a family.