Excellent post. As I said earlier, the reasons people are homeless are as varied as there are homeless people. Mental illness, substance abuse, educational development issues all pay a significant role, as you argue with evidence a majority role.
I don’t agree that prison is any use at all in dealing with drug the drug addicted, and may play a part in further expatiating homelessness through the impact of drug related criminal record on employment opportunities.
But yes all the issues you mention are part of the reason for homelessness.