Judges very much, all the time, deem whether a contract is exploitative or not. Valid contracts are signed between two parties where both are very much aware of what they're doing and fall within non-exploitative bounds.
You're not allowed to contract yourself into slavery no matter how much you want to. Indentured servitude is similarly illegal. You also can't charge someone a billion percent interest on a payday loan.
Now, granted, some people see the absurd levels of modern student debt as something not so far off from indentured servitude. But the point is that the government and judges absolutely draw lines between which contracts are permitted and not, for the express reason of protecting people from being led into terrible mistakes no matter how much they may want to. Kind of the same thinking behind certain drugs being illegal: the government trying to protect people from their worst impulses.
Of course, libertarians (as opposed to liberals and conservatives) think people should be able to contract whatever they want, hence the "liberty" in their name. But pretty much everyone else on the political spectrum thinks it's pretty essential to protect people from the absolute worst irrevocable things.