A quick bit of arithmetic reveals that we charge a significant amount ($50k+) for what we do, but put <10% of that back into the final product. (I can only account for about 8% of it.)
Nobody needs what we do. If my workplace collapsed in an earthquake, nobody would notice. Most people don't even know we exist, and are very surprised that such a facility exists here.
As you say, these thoughts have a serious impact on me. Every time we have a new hire I urge them to join the union and to use the place like it's a one-night stand. I would do almost anything I could find, but there is little appropriate work for me.
For example many government and institutional project assignments are a complete waste of time and money to begin with.
Quite often they're a checkbox on some bureaucrat's desk.
Some perfect examples of this is you can find when looking at the (technical) tenders the European Commission issues. Pick your (tech) topic and be sure find a few million being thrown at some research projects that are never being utilised, or of which the outcome literally doesn't matter.
All being funded with taxpayer's money. There are hundreds of these projects being funded every year, and they are a complete waste of money.
While there are people dying on boats to get into the EU, they are funding machine learning and AI research projects that would be laughably outdated 3 years ago.
However, if one company doesn't pick it up, another one will. It is a whole ecosystem of its own of companies and organisations applying for useless EU projects.
Perhaps the problem is not the companies fulfilling these assignments but rather the governments that issue them in the first place. Or the general public that lets their taxpayers money get wasted like that in the first place.