You wouldn't have a compiler without someone having developed formal language theory. Or, at least, probably not one built on a solid theoretical foundation that actually happens to be helpful.
You wouldn't have complexity analysis of algorithms, with which most of us don't need to directly involve ourselves, but you do apply its results when choosing an algorithm based on the knowledge that was originally obtained through that analysis. Or if you're not choosing your algorithms, at the very least someone who chose them for your platform did.
You probably wouldn't have lossless data compression (and an understanding of it) at its present level without someone having done mathematically-based work on things like arithmetic coding [1] and range encoding [2]. Again, you probably don't write that code yourself (I haven't), but it's there.
The list goes on.
A PhD degree isn't really a good investment in terms of just salary in almost any field that I can think of. That just means work that's closer to (and directly applicable for) direct revenue streams tends to pay better than work that's further away from them. That doesn't directly mean work that's further away from revenue streams is less valuable down the road; it just means there's less certainty about its ability to help generate revenue, and that there are more steps, more interim work and a greater financial risk involved. While most businesses don't, and shouldn't, bother, that doesn't mean they might not benefit at some point if someone else does it. "The market has spoken" is a shortsighted way of looking at these kinds of things.
Sure, there are areas of theoretical computer science that are more similar to pure maths in terms of abstraction and applicability, and which are pretty much a pure intellectual pursuit. They are very far from engineering or applications. But theoretical work in CS is broader than that, and some of it underlies much of what we have in the practical world.
It's also true that most of software development and engineering work don't really require involvement with much of the theory, partially because someone else is already doing that work within the platform, and partially because most business software is actually theoretically more or less trivial.
Still doesn't mean the theoretical side is useless, because not all software is trivial.
[1] https://en.wikipedia.org/wiki/Arithmetic_coding
[2] https://en.wikipedia.org/wiki/Range_encoding