It's really not as simple as that. For example, typically an employer is not allowed to fire you/let you go for going on parental leave. This hypothetical SF engineer is unlikely to get his old job back after 3 years. What are e.g. your health insurance and rental costs in SF during the 3 years you're off? In many countries all workers have certain benefits by law, this affects the society as a whole so you get benefits from that. Even if this specific engineer is better off, which isn't that clear, they're still impacted by society as a whole.
I'm not suggesting anybody do that, I'm suggesting that people move to SF for work because the pay makes up for the perks you get elsewhere. Europeans software engineers are better off moving to SF, working for a year, then moving back. Many people do this, mostly for multiple years.
I mean that the cost of living in SF isn't relevant because you can move. I'm claiming that if you're top ~25% software engineer with 5+ years of experience, you're much better off working for one year in SF, then moving to France for 3 years vs moving to France and working with 3 years parental leave. You'll have way more money at the end of 4 years if you spend a year in SF.
I very briefly looked at SF, and decided that if I were to work there, I would want to commute via Cessna.
Because at first glance, SF rents are so bad that learning to fly and owning a small aircraft isn't immediately obviously the more expensive option, like it would be in Europe.
I walk to work and buying a new car every year + gas + insurance + parking would be less than 10% of my income, whereas I would need to save for years to buy a plane and couldn't possibly afford the upkeep and storage here. So seems like a pretty silly comparison.