This isn't true, at least of all the tech workers I've worked with. None of them could afford to live within a 30min commute of a downtown SF startup.
One good reason to leave the city would be if you prioritize renting a house with a 6000 sqft suburban lot, which you can’t find in the city. Another would be if you have kids and want a good school district.
For example, living in Daly City would give you a ~30min commute, and the average rent there is $2,500, so $30,000 of post-tax income annually. High, obviously, but certainly doable on most SF dev salaries; Hired says the average there is 145k gross, so perhaps 100k or so after tax: https://hired.com/page/state-of-salaries