100% this. If the hospitals are desperate to increase the supply of doctors in the states (US), they can easily fund the residency spots themselves. They pay ~60-70K USD/year for each resident for three years anyway. Those residents do most of the grunt work that more senior doctors (like attendings and hospitalists) in the hospital don't want to do. In comparison, generalist attendings and hospitalists (full-blown doctors) at hospitals earn salaries in the range of 210-250K USD/year easily.

To become a full-blown doctor in the US, one has to jump too many hoops and hurdles including --
1. maintaining 3.8+ GPA (out of 4.0 max) in undergrad while paying overpriced college tuition (which encourages students to take relatively easy course load other than the required ones like organic chemistry, biochem, a couple of basic math and physics classes, etc.);
2. pay yet another loads of money to attend med school, which is where you actually begin to learn something relatively useful;
3. volunteer unpaid at various research and/or healthcare institutions to beef up one's resume (which is only affordable/possible if you are well-connected and/or have money to volunteer);
4. pay exorbitant and unnecessary exams (each 8-9 hours long spanning sometimes 2 days for Step 3 USMLE: https://www.princetonreview.com/med-school-advice/usmle) that promotes rote learning (and you forget what you memorized ~2 months after the exam anyway);
5. pay a lot of money to apply for residency programs while footing the bill (hotels and air travels) yourself to go around the country for residency interviews;
6. spend 3 years (minimum) in residency while spending ~60+ hours per week in your first year doing the grunt work that no senior doctors want to do (e.g., night shifts/floats)
7. maybe spend another 2+ years in fellowships if you want to be a specialist

In contrast, one just need to do these in my home country to become a doctor (I know India has a very similar system to train their doctors):
1. get a high score in national standardized/matriculate exam (in my country, ~5% of top students have option to go to medical school) to get into public medical schools (there are four of them and three of them are definitely pretty good)
2. spend 5 years studying medicine (to be honest, they can cut out the first year if they want to, but it's still better than spending 4 years as undergrad in the US)
3. spend another 2 years as a rotational intern at major government hospitals (OBGYN, Surgery, Child, etc.) doing what the residents in the US system do [from what I've been told, those 2 years are certainly more demanding than the residency years in the US system]
4. take masters degree to specialize (takes ~3-4 years)

The quality of the doctors produced by these two aforementioned systems is not that different. How do I know this? My wife (foreign medical graduate) is a current medical resident at a US hospital and we have a lot of friends in the US residency programs, some of whom are foreign medical graduates. In order for them to get into these residencies as foreign graduates, they have to score on average better than their US counterparts (on top of having to work pretty hard to gain experience in the US because 99% of hospitals/medical institutions in the US don't allow volunteers/externs/interns unless one is trained from the US pipeline and is a citizen).

So the question is why is the path to becoming a doctor in the US needs to be paved with so much expenses and hurdles? Who established this path?

I'll close my long rant with what my wife recently told me after spending a year as a medical resident in the US, (I'm paraphrasing her a bit here) "I don't want to be a patient in the US hospital when I'm old. We need to go to somewhere like Singapore for treatment (she worked at a hospital in Singapore for a bit before coming to the US)."