There are a number of reasons to keep people around who aren't providing sufficient utility to a business (from the high-level business's notion of utility).
1. Fiefdoms. A manager is valued by the number of direct reports and charts they can direct upwards. As long as they aren't losing money, the business doesn't usually seek out perfect efficiency.
2. Historical. A position that had value 10, 20, 30 years ago continues to be filled (or is still filled by the same person or people) because "It's how we've always done it." No one with sufficient clout has stepped in to evaluate the situation and remove people.
3. Deliberate bullshitters. Ever seen a job done manually that you know a computer could do faster, more reliably, and with better accuracy? These people know the job isn't useful, or as useful as it should be, but they inhibit the improvement processes that should happen and retain their positions for a long time. They often make themselves important by inserting themselves into other critical business processes.
4. Regulatory. Does anyone really know what "QA" does? (Qualifier: Not testing, a specific person holding the QA title sitting over software and/or engineering) IME, this person usually just checks boxes when final qualification testing is done on critical systems, but few of the QAs I've known have actually brought value to the organization in this role. Most are there because the business knows they need it to meet legal or industry standards.
Markets aren't perfectly efficient, and a belief in their perfect efficiency isn't going to make it so.