My solution: student loans may be discharged in bankruptcy, but your school records are discharged too. Thus if you get an expensive degree that won't pay off the loan just give up the degree and credits. Doctors will not do this because their pay.
Note that loan companies now have incentive to ensure you graduate and get a job. Getting Ds in a few classes: they will cut you off now rather than try to see if you can turn it around. Maybe you can find the money to pay for your next semester one your own and improve your grade, and if you do this long enough they might change their mind and give you loans to finish.
The only angle I'm still working out is if someone finishes a degree, declares bankruptcy, and then goes back to the same degree (elsewhere) - they don't have the credits but they presumably know the material and can easily pass all the classes the second time around with a better grade.