> Why are companies putting up with them?
There's always the human factor in capitalism. And with the human factor comes ego.
IIRC, Graeber roughly compares CEOs to feudal kings. You want more people under your rule as a metric of success. Also, the "king" often seeks to have a big "court" (top-level managers) to reflect their prestige.
The effect is cascading. The "king's court" members want their own smaller courts (second-level managers) and compete with their peers for power, as measured by the headcount. As we go down, unecessary hires will start to occur, only to justify a title.
And everyone involved in the theater has an incentive to turn a blind eye on the situtation.
(I know that in eg France is basically impossible to fire people, so I can see why they might have lots of bullshit jobs.)