The actual chances of getting a tenured position (or another permanent academic position with research opportunities) are more like 1 in 3, or even better. Most people who get a PhD and are in priciple interested in staying in the academia leave, because they are not willing to make the necessary choices.
And the biggest reason why people leave is not the pay, the stress, the politics, the struggle for grants, the publish-or-perish mentality, or whatever else people are complaining about. It's the forced relocation. You can choose where you live, or you can try to get an academic job, but you can't reasonably expect both. Universities are wherever they are, and their needs for new faculty are unpredictable and highly specific. If you are not prepared to drop everything else indefinitely and move to a place that is actually willing to hire someone like you, you are not serious about staying in the academia.
It turns out most people are not that career-oriented.
Roughly speaking, there are 10-20 PhDs for every faculty position. But not every PhD wants a faculty position, even in principle.
Many want to do research in the industry, or in public research labs. Many do a PhD because it opens doors in other careers, such as medicine or education. Some PhDs are hobby projects people do in retirement. Some are side projects for people who want to study something relevant to their main job (those are quite common in social sciences).
Then there are those who actually want a career in the academia. But many of them are not trying seriously, because they restrict their job search to a single city / region / country. The 1 in 3 chance is for those who are flexible enough and committed enough and accept the realities of the academic job market.
Most of my classmates would have been very interested in an academic career if they thought their chances were even one in ten and this was in a top tier program. And they were all totally willing to relocate too.
The best estimate I can find is that about 3.5 million people in the US have a PhD or another research doctorate. That includes non-immigrants who study or work in the US. According to AAUP statistics, there are ~200k full-time equivalent tenured or tenure-track faculty in what they consider doctoral institutions. Such positions are the typical but not the only option for a research career in the academia. The numbers are well within the parameters I used for my estimate.
It's important to understand that in this context, willingness to relocate means willingness to spend your life outside your home country. Even in a large country like the US, there are often structural reasons why universities are not interested in hiring someone like you when you are in the job market.
For example, maybe a field such as ML starts getting popular. Universities respond by hiring new faculty, who in turn hire new PhD students. Almost a decade later, when those students have graduated and are in the job market, the demand may have stablized. Universities already have a plenty of faculty in that field and have little interest in hiring more.
Which means that if you chose a popular field, your chances of getting hired may be below the average. If you want to stay in the academia, your best bet may be moving to a country that didn't experience a similar hiring frenzy and is now trying to catch up.
And the biggest reason why people leave is not the pay, the stress, the politics, the struggle for grants, the publish-or-perish mentality, or whatever else people are complaining about. It's the forced relocation. You can choose where you live, or you can try to get an academic job, but you can't reasonably expect both. Universities are wherever they are, and their needs for new faculty are unpredictable and highly specific. If you are not prepared to drop everything else indefinitely and move to a place that is actually willing to hire someone like you, you are not serious about staying in the academia.
It turns out most people are not that career-oriented.