Housing in SF and NYC are on some level substitute goods. Many of the people living there are mobile and the ones deciding prices on the margin. If SF rent was $10k and NYC was $3k, many are going to leave SF to get a similar type of lifestyle in NYC for cheaper, raising demand for NYC housing. If SF zoning laws allowed building an incredible amount of housing, lowering rents to $2k, while NYC is at $4k, many people would leave NYC, lower housing demand and thus rents, to get a similar urban lifestyle in SF.
This is the whole crux of why NIMBY is such a collective problem. When NYC doesn't build because SF should, when SF doesn't build because the Bay Area should, when the Bay Area shouldn't build because Texas should, everyone collectively pays higher prices because overall housing supply is reduced and many people move between them.