SF has a lack of condos. What can you buy for $400k that’s much better than that studio? For $1800/mo, you can rent a 2 br in the hood or a 1 br in an ok area.
Or you can buy income property in Oakland for 7-8% cap and use the income to offset your rent in the city.
The market in SF is much more f’ed up than even Manhattan. I have a studio apt that could be a nice 1 br, but if I wanted to live near Columbia University (decent area with slightly bad rep), there are 2-3 br apts that show up for under $400k periodically.