The public transit system shuts off by 12 AM - 1PM, and most service workers would likely have to live outside of the city, as well as most people coming into SF to work. The city is forced to shutoff at a certain time because of the transit situation, even if not for any other reasons.
The current disparity certainly causes plenty of concerning issues, though SF's early closing has been a thing since at least 2007 when I first lived there, at which point cost of living was somewhat reasonable.
I moved here because it had a pleasant climate and (once had) a vibrant art/culture scene that provided ~80% of what you could get in bigger cities, at a discount. It was a city, but with a higher quality of life. For that, you might be willing give up some things.
That's no longer true. I don't know how new people rationalize the costs here, except as an "investment" into something else -- their career, real estate, whatever.
Even then, the jetlag only made it work for a week or two.
As others have noted, people who have the sorts of jobs that put them behind a register can't afford to live in SF, and public transportation shuts down at midnight or so. If you were working a restaurant it would have to close by 10:00 so you had time to clean up with a little buffer to make sure you were on the last train.