The first thing to know about genuine friendships is that they usually don't form when forced. Sticking 6 devs from different cultures, generations and seniorities in a room and saying "ok be friends now" is wishful thinking, the kind of simplistic shit you usually get out of management. To think that RTO is a solution to this is naive, sorry to be blunt. It has far more to do with who you hire. Lazy/incompetent management would prefer the easier RTO mandate, as usual.
You can only incentivize the behaviour you want. It can’t be forced. RTO does do this in a stronger way than fully remote, in second-order ways. Simplistic as it might be, if those are the only tools available, those are the ones that will be used. It’s been five years since the pandemic now and a better way hasn’t been found yet.