$40k per year is a relatively livable wage. $19k is not. Especially when you have comparable student-loan payments.
Considering the student loan costs, I'd hardly call $40,000 livable even in a low cost of living area---especially when you consider that you will more than likely be paid less working there as a doctor. It's a wash, really.
As for payment comparability, while both are a mortgage (cost vs. income,) The doctor is paying out more of his money to the bank, but the pilot would be paying a much higher percentage overall.
However, we're looking at first year pay here. It's not Walmart wages, but given the experience, neither are deserving of top dollar, either.
Granted, the doctor won't have to worry about going back to square one if he changes hospitals/networks. That, IMHO, is what needs to be fixed in this industry, and with that, I mean the WHOLE industry, not just pilots.