This is one of things, like corporations being able to sue governments, that sounds horrific but has relatively clear benefits because if the risk is too high the business deal won't happen. A classic prisoner's dilemma, and the answer to that is always to change the rules of the game to try to make cooperation pay for both parties.
Not that both systems couldn't be improved.
In bankruptcy court they are protections, you cannot have $2 mil in the bank or a $250k salary and try to get out of paying $92k in student loans.
Which, the above happened in the late 70's and early 80, as bankruptcy protections were whittled away for everyone, because of a small percentage of bad actors.
The doctor issue seemed simple: a judge has to approve the bankruptcy. And they can make a determination that it was happening to ignore scholastic debt and cancel the doctor's license. But I guess the "applies to every american" was much more profitable.
The borrower that took the loan--you signed it, right, and you were 18+ years old ? --makes a calculated decision on whether to file for bankruptcy or not. It has costs for the filer, at least for 7 years, and possibly for life (some jobs will ask if you ever filed for bankruptcy).
Other than that, who cares: you are a big bank...sometimes you win, sometimes you lose. You should treat a bank like it treats you, if you can get away with it, of course.