Yes, but we need to keep in mind that a PhD
is necessary to teach some things, just not all of them. You don't need a PhD to teach Calculus, or a writing class, or intro chemistry. But if you're teaching something sufficiently advanced, such as non-intro-level complexity theory or algorithms, you probably wouldn't be qualified to teach that subject without a PhD - not that you need the PhD per se, just that the vast majority of qualified teachers would have one anyway.
I think the solution to the other problems you mentioned exists, it's just hard. This depends heavily on the field, but at least for Math and the more theoretical disciplines within CS, you don't make progress by throwing more money or people at a problem. You make progress by having the right people working on the important problems, not by having more people working on more problems. Currently in technical fields my impression is that a PhD is an immigration tool first, a job credential second, and a way of becoming a researcher (not just do research for four years, but an actual interest in a career of research) third. This isn't a rant against immigrants at all, and I'm not blaming them for the current state of research, because for them getting a PhD is just a logical way to play the immigration/career game.
But because immigrants/people looking for credentials see the PhD as an investment in a next step in their life, they've in a sense driven the "market rate" for entry-level researchers to the ground, because they're willing to sacrifice for it. There are a lot of really smart people graduating with Bachelors degrees this year who are going to work at places like Jane Street, Facebook, Goldman Sachs, and McKinsey, and they're all going to make at least $100-200k/year starting, to $250-400k after five years. It would be almost insane for these people to pursue a life of research, because even if they would be very good at it and love the research itself, they'd be working an extremely stressful $20k/year job for ~4 years for the chance of becoming a researcher. I'd bet that a lot of the greatest technical minds of our generation, who could have been great researchers in math, CS, physics, etc., are gravitating towards these jobs because the value proposition of research simply isn't there.
Ultimately what we need to do is pay PhD students more and make it more likely you will actually be able to go into academia after completing one. In other words, we need to make getting a PhD something people do because they want to do research, not because they're trying to change fields, or needed more education to reach pay grade n with an employer, or even because they want to immigrate (again, nothing against immigration, I just don't think a PhD is an appropriate channel from a policy point of view). I think a lot of problems, including publish or perish, would go away if you didn't need to be a top 0.1% researcher to get a good position in academia after graduating.
We also need to be extremely careful to not let a PhD become simply a third tier of tertiary education. I have a lot of problems with the education field offering "PhDs" and "EdDs" which are little more than a second master's program (there's some irony here). This is pretty much exclusively caused by these degrees being arbitrary barriers of entry to promotions within the education field. I hope this doesn't spread elsewhere because it really cheapens what it means to have a PhD.