There are jobs all across the country. The total cost of living in SF is the highest in the US right now, so it can't be the pay that's attractive - if you're making $250k/year and paying $1mm for a starter home, you could almost certainly do better living elsewhere at a lower salary.
Jobs could still be a component, but I would say it's the character of the jobs, and the character of the area, that draws people.
A home being only 4x your yearly salary is a much better ratio than most of the country. You could theoretically pay that off in 10 years without much sacrifice and most mortgages are 30 year terms. When you add in prop 13 which prevents your costs from rising with the market, then that seems like a great deal all around
Jobs could still be a component, but I would say it's the character of the jobs, and the character of the area, that draws people.