The primary reason for this is companies either own or lease large office buildings (and often the land the building sit on). They can't sell the buildings or get out of their leases, so they want the buildings occupied.
Punish employees because the corporation made stupid real estate decisions—class act!
;-)
And that is a totally valid argument from their point of view, especially when they are spending huge amounts of money expanding existing campuses or building new ones. Apple built a new complex. Google was in the process of expanding their Mountain View campus, at least until Covid hit. But for what .. if employees don’t want to return ? All for naught. Btw I have been to the Googleplex. It truly is impressive.
They should pay people more for working from home - they are making a smaller carbon footprint and helping to save the erf!