Citizens at the margins who can't find a place don't go directly to the streets - they crash with family, then friends, then live in their car (until they can't afford to move it). Most homeless in SF are invisible. Getting this cohort into an apartment is mostly dependent on having affordable apartments.
Everyone was on /r/vancouver was like "where did all these people come from?!"
Well it's as you say. They were the "hidden homeless," couch surfing at their friends.
All of a sudden the pandemic hit and these publicly owned social housing apartments added new rules saying "no guests" and such, and suddenly boom, you see the real amount of homeless.
Then misfortunes happen, they lose their job, they lose their health, they lose their apartment etc etc.
Now they're stuck.
They don't move to cheaper areas of the country because 1) there are real costs to moving (money they don't have) and 2) the economic prospects in the cheaper part of the country are worse.
This is not meaningfully true for people with lower skill levels. You can have a much higher standard of living as a laborer in Laredo than in SF.