It's very common for people working in the global economy (in this case, the tech portion) to want to live in urban areas. Silicon Valley is a great place to raise a family, the ultimate string of bedroom communities flanked by other bedroom communities. But people ages 25-35 really want to live in urban areas, and besides Seattle, San Francisco is the only place on the US west coast that has that combination of high density and high paying jobs to lure them there. The dating scene in Silicon Valley is sad at best which pushes a lot of singles in to the city.
I don't feel like posting a second time in this thread so I'll say it here, as someone who hasn't started a family yet, I love the city, but once we have children and they're big enough to need their own space, we're going to have to move out of the city. We both have really fantastic jobs, but can only afford a 1 bedroom here, a two or even three bedroom apartment would bankrupt us. Adding a 30 minute commute each way moves us from a 1 bedroom apartment to a 3 or even 4 bedroom house with some semblance of a backyard. I just got back from a ski trip with six other couples, those who still lived in the city and had one child (under 2 years) were looking to move out, the rest already had children and had moved out of the city, or had already fled the city to find housing where they could comfortably raise a family. We're not talking about junior level developers, these were all people in their early to mid 30s, comfortably midway through their careers with household incomes in the $250,000 to $300,000 range. We all want to live here, but we can't find space in good neighborhoods, and we're all looking at ways to keep them out of the SF public school system. SF is on par with 2017 Manhattan prices, but on par with 1977 Manhattan crime and schools. San Francisco is a great place to live, but an awful one to raise a family in.