Being unemployed does not result in homelessness unless you also join it with either a drug addition or an aversion to the requirements of unemployment/shelter programs.
You’re assuming that those programs are well funded enough to have space available, it’s safe, and doesn’t come with the expectation of working. I don’t know where you live but that’s a long way from being universally true in the United States.