The unfortunate reality of drug addiction is that even for people who want out it’s very hard. For people who don’t, it’s quite a lot harder. If there was a magic pill that cured addiction I think we might make different policy choices, but given that there isn’t I don’t see how your plan can really work.
Just giving the homeless a moldy and bug infested tiny room without any additional help isn't going to help much. It's "housing first", not "housing only".
I don't think you understand addiction and rehab, frankly. Getting people to stop using drugs is quite easy, just keep them away from it for a while. You can send anyone to prison or rehab, and they'll stop using drugs for a while.
The hard part is getting people from restarting to use drugs once you let them free, and you can't even hope to do that successfully unless they are motivated themselves, which they won't be if they live on the street.
While I agree, there are many shelters that people don't use because they don't want to be sober, which defeats the purpose of reducing homelessness.
I saw this tweet from the Y combinator ceo that says 25% of those in a permanent housing program in SF died. (I assume of overdose). Getting people housed shouldn’t be the priority, the priority is getting them drug free. https://twitter.com/garrytan/status/1659972231328583680?s=20