The line employees are just responding to the incentives that these two groups create, they aren't the ones steering the ship into the ground.
Any significant layoff that doesn't have a disproportionate number of people from those two groups thrown overboard is ass-covering. They are the ones who screwed up.
They do, but they are often blind, due to fog of war, of what actually happens in their firm.
Middle management controls that - by deciding on what kind of line-work (which they have visibility over) gets rewarded or prioritized. If the line engineers are spinning their wheels, doing architecture-astonaut nonsense for the sake of promotion, that's not because the CTO is rewarding it - it's because their 100-person director (who should at least vaguely know what each of their reports is doing this year) is.
There is a lot of opportunism out there.