The problem is multifold, sure. I’m suspicious of purported “solutions” that don’t take this into account - that’s a sure sign of someone selling an agenda rather than a fix.
I don’t want to make this issue so big as to make it unsolvable, but housing policy does play a role. So do welfare rates and residency requirements for them - this is why San Francisco traditionally had such a big homeless problem. Government shelters have their role to play, but so do private charities, which are more likely to insist on good behavior and work among the people they help.
I think laws ought to be set fairly and enforced fairly. The homeless do not have the right to panhandle, extort money by squeegeeing car windshields, urinate or defecate in public, engage in public sex or prostitution, drink on the street or use illegal drugs. If they refrain from doing these things, they ought to be left alone. Public bathrooms should be reopened for them, even if the entrances have to be monitored.
Even if we do all that we can, there will be a small subset of people who choose to drift about the fringe of society. Some of these folks were mentioned above. If they are not criminals, they should be left alone as free individuals in a free country dealing with the consequences of their freely made choices, however unwise we would consider them.