If you would truly be homeless if you went bankrupt, then yes, it's not prudent.
But many of the people who would be in this position have a safety net if things go bad. They can default on their debt, move in with a friend or relative, and get a job and get back on their feet.