There will always be a percentage of homeless that are as you say, usually because of mental illness. To say "most" of them fall into that category is a huge assumption to make without data to back it up.
And you cannot get a decent job without a place to live, which also puts pressure on bankruptcies. You cannot share an apartment when you have a family or when you cannot afford even that.