London is going this way too
I think the solution in this case is not to work in San Francisco until you have moved up the ladder a bit and increased your earning power.
This is the exact same advice I'd give to anyone starting out on their tech career in the UK.London is also heading this way, with rents and property values spiralling out of control but entry level wages not budging.
Start out in cheaper cities like Leeds or Birmingham, then move to London only if you REALLY want and have the experience to command a better salary. As well as lower costs helping your bank balance, if enough people do this then tech companies in big cities (be it London or SF) may have to start paying a living wage in order to get the entry level talent they need.
For the UK specifically, an even better outcome is for more companies to move technical jobs to provincial cities and spread the wealth around the UK a bit more. If they can't attract the talent they need in London at a reasonable salary any more they may have to look elsewhere in the UK. The concentration in London has become unhealthy and unsustainable for any number of reasons (housing, public services, transport...).