The teachers, janitors, baristas, etc will move to the location that gives them a better quality of life. If they decide that's not San Francisco, they can move to a better city. If SF wants them back, SF can sweeten the deal for them.
I guess it's kinda sad that not everyone who wants to live in SF gets to, but I'm not sure how "closing the door" is any more fair.