According to the AAMC, it seems like residency slots have also been an issue: https://www.aamc.org/news-insights/medical-school-enrollment...
I had a major operation just before 2017's intake it was interesting having a new doctor trying to cannulate me - I suspect the nurses where round the corner trying do to laugh.
I know of several doctors who are in _significant_ debt despite working for the public sector for years. Their loans are forgiven, but the residency sits and accumulates interest that they can't quickly pay off because that same public sector work doesn't pay as well.
It's not-quite slave labour.
I don't know the most about this field and you're right, a bunch of hospitals do pay. That's cool.