Being in the office helps with opportunities to get ahead because there are more opportunities to suck up to the more senior people (who are in the office to suck up to their senior management as well), and to be able to slag off others.
My director is in the Netherlands. He reports to someone in Germany, who reports to someone in the USA. My director's DRs are in USA, Netherlands, Russia, Germany, UK, Dubai. The teams below are spread across even more countries. Being in the office doesn't help you that much with us, except once or twice a year (pre-pandemic), at which point we would be called into the office. Being able to build relationships remotely using email, instant messaging, telephone and video are key skills with us. If someone is in a different country, while they're working on desk-based tasks (and not all are - quite a lot of us have to visit data centres and field sites from time to time, just not all the time,) it makes little difference whether they're in the office or at home, as long as they can connect to the network.
Because of how we operate, being able to manage virtual teams well and learning who people are when you are not face to face are valued skills. And it is possible, even in different timezones.
Newbies get trained online, with shared screens to work through tasks, people are available to ask questions. This very morning, I shared a screenshot of an error message to see if others had experienced it, or if it was just me. I've got a wider range of people to ask than those based in my own office.
Younger workers coming into the office will be used to communicating with people by various online tools. It is good to meet face-to-face. It's why the company is prepared to invest a fair bit in airfares and hotels to enable it, at least in the past.
But not being face-to-face shouldn't be much of a barrier these days, because there are technological options to be in touch, to track staff, just chatting, and managers should be making the effort to do so, wherever staff are.
There are plenty of reasons why it's good to have people in the office. Some job tasks can't be done at home. Some people don't have the space or privacy to work effectively at home. Some people will take the piss - but that has always happened. Even when people were totally office-based, I'll bet you knew who among your colleagues worked hard and who didn't; it's not location-based.
I'm glad I work for a company where it's recognised that physical presence isn't a key marker of people's output, abilities and potential for promotion.