If you define taking pain pills to get high as “taking too much medicine” and then making bad decisions while withdrawing is “too little medicine”, then yes that is a very significant minority of people ending up homeless.
But it doesn’t account for people addicted to meth, or alcohol, or people suffering from schizophrenia, etc.