Building boomed in SF during the GFC (2008 et seq) so there was extra capacity as things recovered, and eventually space was at a premium again. The real estate glut helped early stage startups.
> presuming they don't exclusively work remote or choose NYC as their primary hub.
I love NYC, and am even on a couple of boards of actual tech companies in NY, but c'mon it doesn't make a lot of sense for tech businesses, except I suppose some fintech. Advertising, online retail, sure, I suppose, but those rarely need bespoke technology, much less anything novel. But California's level of investment last year slumped to only 3.5X NY...it has a long way to go. And much of that slump was in SF -- SV held up much more strongly, as you could also see in the real estate article posted on HN today (NYC commercial vacancy rate isn't as high as SF's, but is higher than SV).
These hot spots thrive on network, and nowhere are the networks more intense than NY, but on the tech side the biggest, most active network in the USA, err, world, is still in the Bay Area.