Having worked at a fully remote company before (and during) COVID, I'm surprised so many companies have stuck with it for so long.
IME, remote work works best when everybody in the company buys into it and there's an effort to make it run smoothly. Conversations in chat, always online meetings, etc.
Considering most companies were forced into remote work by a pandemic with no planning or anything, it's surprising it's gone as well as it has, but it's also not surprising it's gone badly for a lot of companies.
IME, I'm a CFO so see every department this is not specific to software industry, it went well but it also ultimately highlighted how inefficient most company's office workers are. So once those people adjust to WFH, get caught up on a backlog of projects, etc. (the "being very good at WFH" phase) they eventually become unnecessary and headcount reduction becomes more obvious next step even though WFH "worked". But, there's also the part about why did the backlog of projects not continue to grow? What are we working towards now? etc. The response to this is making people RTO, because we feel that we broke something by going completely remote. The company isn't as connected, they're just coasting now pushing things forward, etc. These are the kinds of reasons that employee's and executive's see the RTO issue so differently.
I've personally worked at 4 different companies since early 2020. Not everyone does WFH well. Many pretend they do, but don't. Even those that do it well, do better when they meet regularly in person (have some hybrid model). Some teams/departments/functions are better at it than others, but companies as a whole I think perform better when the people have personal connections and relationships across the org. In a remote WFH situation, over time, through natural attrition, new people are onboarded and never actually meet anyone in the company and this becomes a large portion of employees that are very loosely connected in terms of their interpersonal relationships/network and this weakens the organization. I can see how that is fine in a individual contributor role of SWE, but for most roles, in most departments, it doesn't play out well (or takes a very special/rare personality trait to actually do it well).
Easier to force people back versus fix bad management, because bad management is everywhere.
(there is $120B+ in remote enterprise market cap as of this comment, anyone saying it doesn't work is not accurately representing the situation; it might not work for them because they are unwilling to make it work, but the evidence is clear it can work, does work, and did work during the pandemic)