A seemingly significant part of it is because the young talent wants to live in SF and not commute 1+ hours to an office park in the South Bay. I think SF also offered incentives for tech companies to set up shop in the city in the 2009-2012 time range... https://www.wired.com/story/no-more-deals-san-francisco-cons...
It also generally became trendy for that demographic to live in (certain) cities after they graduate. My company set up an office in the Seaport (partially) for that reason because our main location an hour west of Boston was a deal-killer for some people.
That's certainly true. A career in tech became widely popular and trendy for millenials and now zoomers (I believe CS is now the most popular undergraduate major across US colleges?). Basically once people realized you can make more money in tech than on Wall St, a percentage of new grads who would have moved to NYC diverted for SF.
>I believe CS is now the most popular undergraduate major across US colleges
I saw that in one Google search and it seems incredibly unlikely. This seems much more probable (even if you assign some of the engineering degrees to CS):