1. If you go bankrupt, most stuff can be taken away if you can't pay for it. I can take your car, house, etc, but I can't take you education. You still have the full and complete value of that, so I'm not sure it's obvious that bankruptcy should remove the debt.
2. When you graduate, you typically haven't really got any money yet. It would be very easy for recent grads to just go bankrupt before they start accumulating wealth, and then go on with their lives without the loan debt.
It shouldn't need to be said, and yet it appears that it does, that bankruptcy is not without consequences for me, even if you fail to rob me blind in the process. A bankruptcy will limit my ability to rent an apartment, get a car loan, or win certain jobs. There is no story of people scamming bankruptcy in the US, not even in the recent past when educational debt was still dischargeable.
Your second point is fair, though. That's why student debt shouldn't be a thing.
On the condition of getting the federal student loan is that the loan is exempts from bankruptcy. The loans follow us to the death or until it is paid off. It actively screws those naive students until to the point of no return. I have a friend who is still stuck paying the loan more than 15 years because the wage are not above the cost of living.
This is a huge legal binding part caused a lot of them instantly debts trap while the universities keep pushing the envelopes with the tuitions without oversight
Edit: But there are federal loan forgiveness programs. They have many of them. If your degree in your career and it end up into career ending situation, they have a program for this. However, I don't know if those program changed due to DeVos involved meddlings with various programs.