So essentially we became figureheads. Our work rarely was used in any significant way or provided much value, but we were kept around because the company wanted to be able to tout its “data driven” culture.
It was so bad that at one company I worked for, they had the data science/analytics department start putting on a yearly intracompany conference on analytics that became a huge deal. One year they got Stephen Levy, the author of Freakonomics, to be the keynote speaker. At one point he shared a story about how he was consulting with a company on their marketing, and they found that they had accidentally not been running ads in a particular metro area, and were able to leverage this to act as a control to assess the materials effectiveness. But when asked to intentionally do something similar moving forward, the company balked. It was so close to home that my colleagues and I wondered if the head of our department had fed him the need to talk about it. And yet, not a single thing changed at the company during my time there.
I currently work in a role much closer to software engineering, and I have all of the same problems described by the person in the original post and that many are describing here. But I consider it a strict upgrade over my time working as a statistician.
The situation in research is exactly as you describe -- we are figureheads who are put into place and highly pressured to confirm whatever hypothesis a PI wants for their latest grant or paper. They would never ask us to commit fraud, only perhaps to "double check" an analysis 10 times until it shows what they want to see.
If I were working for a company, this would at least be understandable, as companies don't even have a theoretical commitment to truth and scientific integrity, and there are no real consequences to a faulty analysis.
But it is immensely galling to see in research. Here we are, paid by the public to supposedly pursue truth and improve human health, and instead the job is to constantly be finding ways to avoid fraud and fabrication without pissing off the collaborator. The result is, as you say, useless analyses if the analyst is honest, and fabrications if they are not.
There is absolutely no doubt in my mind that this is one of the key reasons the ROI on science has declined drastically in the last few decades. It makes me laugh bitterly every time I see (increasingly frequently) political exhortations for plebeians to "trust the science".