This is an example of a local maximum. This form of communication is better for the person doing the walking, but worse when looked at through most other frames:
- worse for the person being asked, who was interrupted
- worse for the people who weren't privy to that conversation but perhaps could have learned or contributed except that they were OOO that moment.
- worse for the organization because knowledge shared this way is ephemeral & siloed by definition
- ineffective in large organizations, where teams often span offices
And all that's before considering the "worse" that comes from having your staff spend 5 hours a week (average in the US) commuting to the office.
In effect, the person walking over is burdening the other party and the organization rather than spend a little more time to craft a question in writing. Weak written communication skills are at the root of why so many organizations are bad at remote work. If oral communications is all that works at your org, then remote is going to be really tough for you (and your inter-office communication is also probably terrible and you should put the whole company in a single building).