While that doesn’t seem like something that _has_ to be in California, it is already here and that’s not something you can just move.
As for why other cities have a hard time competing, it’s the same thing. If CA is perceived as “where innovation happens” then people will look for jobs here. They won’t even look at e.g. Kansas City or Charlotte or wherever, even if there are open roles there.
It doesn’t have to be this way and probably won’t be in ten or twenty years. Especially after this wave of IPOs, SF will likely be unlivable for most. If companies can continue to raise enough money to pay equivalently higher salaries, then the boom can continue a while longer. Otherwise, the numbers don’t make sense.