I will say that fortunately things are better in computer science academia. (Note I'm assuming you go to a top school for your PhD). The extreme competition is still there (even at a top 4 school), but:
1) it is common to skip a postdoc or only do 1 postdoc
2) the "backup" option is going to work for an industry research lab or a tech company for 200k+ per year. And if your field is one applicable to industry, like systems (databases, networking, distributed systems, OS) or AI/ML, you've also gained skills that actually do command a salary premium (although the premium does not come close to the opportunity cost of a PhD) and some job security.