It’s more than a pay shortage. Becoming a doctor is hard. You give up 8 years of your life to school, residencies, insane work schedules, no family life, etc just to start at the bottom of your profession. Not many people are willing to do that anymore so you get fewer doctors.