SF isn't a nice town. It has nice aspects and places, sure, but it's always been pretty rough here just under the surface. The initial Mission was like a concentration camp for Indians. I just found out that SF State University is built on an Ohlone graveyard. Chinatown was harsh, the population was almost entirely male, except for prostitutes who were often enslaved[1]. There were gangs of bandits living under the piers.
What I'm saying is, folks moving here with their great tech jobs and expectations of picket fences and rose gardens are a little naive. You moved to a freak down and then got freaked out by the freaks.
It's always been a weird place to go to start a software business. E.g. Twitter moving into the center of skid row was bizarre. They're not Mother Teresa?
[1] "The White Devil's Daughters: The Fight Against Slavery in San Francisco's Chinatown" https://www.goodreads.com/book/show/41181183-the-white-devil...