I strongly disagree. A PhD in the sciences or engineering is a degree in how to do research and it prepares people for careers in research or for careers that require communicating research. If a person is only satisfied with being a professor at a R1 university, then don't do a PhD, but there are a ton of other jobs that require or greatly benefit from having one, e.g, teaching universities, NASA, government labs, many research oriented groups in companies (FAIR, Google Research, biomedical companies, etc.), science policy advising, etc.
One needs to have clear expectations going into the PhD about what they are trying to do and they need to have clear communication with their advisor.
The vast majority of PhDs in science and engineering do very well and find jobs, but most don't get professorships at research focused institutions. Having realistic expectations is key, but a career in research is great.
A PhD is stressful and takes 5-6 years, but it can be a great experience with the correct expectations and a solid plan. The main problem is that most PhD students don't seem to think about those things nearly enough and have unreasonable expectations.