The larger problem may be that for many jobs we simply don’t need the office at all. The office was the 19th century’s solution to the need for centralized data-processing in a time before telephones and other communications technologies. Back then it made sense to cram all your clerks into a dingy room; but when you did that, you had to create managers to watch them. And herein begins the problem we still face today.
Most managers have incentives that guarantee aberrant behavior. Many do not really understand what those they manage do, nor how best they may accomplish their tasks. They certainly struggle to measure output in meaningful ways (as opposed to largely spurious metrics). So they default to inadequate proxies such as total time spent at the desk.
As you rightly observe, such approaches serve mainly to undermine morale and kill real productivity (though the spurious metrics usually tell a different story, because that’s why they were chosen in the first place).
We can only eliminate folly if we eliminate the circumstances that give rise to folly. Today, with our communications technologies free and simple to use, for a wide range of occupations there is no longer any need to gather people together in offices. People can be happier and far more productive when working from home. There are zero real arguments for maintaining the office (forget the spurious “serendipitous conversations around the water cooler” nonsense — and company relying on this will go out of business in a heartbeat) and many for abolishing it. Think of the billions saved when office space no longer needs to be paid for. Think of the billions of tons of CO2 saved when commuting to work ceases to be the daily grind.
Sadly, no manager is going to advocate this solution because it would mean they’d (a) no longer really be necessary, and (b) those who remained would have to understand their jobs, which would be a cruel imposition.