Well, if you don't answer instantly, then you are stopping them in their flow.
I've noticed this some times ago and now I cannot unsee it: this all discussion is too often about "what is best for me and my flow even if it ruins other people's flow" rather than discussing a proper solution.
I'm not sure you are talking about the same thing when you say "flow" that I think most of the other people are talking about when they say "flow".
Flow as most are using it here, also known as being "in the zone", is when you achieve a deep state of focus on one particular task, and everything else seems to melt away. You reach maximal energy and enthusiasm for the work. It is where you reach peak productivity and creativity.
Most people cannot just enter this state at will, and when they do achieve it cannot maintain it for more than an hour or two. Getting into this state takes 20 to 30 minutes or more.
When you are in this state it takes very little to knock you out of it. A ringing phone, someone talking to you even if you just tell them to come back in a couple hours, a beep from a messaging app...all of those can knock you out of the zone.
Getting back in after being knocked out takes another 20 to 30 minutes. This means that if you are getting one interruption or distraction every 30 minutes throughout your time at your desk it is unlikely that you will get any time in the zone.
>> In the same vein, an office with a door won't help at all if you have higher-ups who expects instant responses to any messaging/e-mail query every five minutes
> Well, if you don't answer instantly, then you are stopping them in their flow
In the case of a manager interrupting you they probably weren't in the zone. But even if it is someone who was in the zone that is interrupting you them having to stop and message you was probably enough to knock them out of it.
It will almost certainly be more productive for the organization overall for them to work on something else until you naturally exit the zone.
For example, you can be "in the zone", and then suddenly realise you need answer X than only John can provide. In the office, you can look at John and he does not look busy, so you quickly ask. Sometimes, people don't even realise they are asking, they are still in the zone, checking if John is available is done by another part of the brain. After the answer, you continue, you are still "in the zone", you still have everything you need in your head, you are still juggling with different variables, they are still there.
Now, if you cannot ask directly, you have to send a message on Slack. And then what? Well, you cannot continue to work on the part you were working on. So you have to switch task, drop all of the variables you juggle with in your head, get out of the context you were in. Then John answers you on Slack 10 minutes later, you have to recollect everything in your mind.
So, yes, that's my point, not being able to ask a quick question will destroy your flow. The effects are the same as being distracted by a question when you are "in the zone".
I don't think that asking someone about something is enough to get out of the zone, as in practice, developers "ask" their computer or internet things continuously. A simple "ls" or "ctrl-f" is as disturbing as asking the colleague sitting next to you.
Of course, it may depend on people, but I think it's just not a smart way to approach the problem as if everyone is always working exactly the same way you do.
I also think that some people will think stuffs will break them out of the zone when it does not always really do, just because they don't even notice the thing happened when it does not. It is a bit like those people who say "I always wake up when the cat pass next to my window" just because the 5 times they woke up, the cat was indeed passing next to their window, but the cat passed there 50 times without waking them up.
I've noticed this some times ago and now I cannot unsee it: this all discussion is too often about "what is best for me and my flow even if it ruins other people's flow" rather than discussing a proper solution.