It's basically that.
I block out chunks of time and disable all distractions during those blocks, I don't have a phone on my desk.
When I started they said to open a ticket with IT to get a phone installed and I simply didn't.
If it's urgent, like production is out - come find me otherwise wait until I reach a natural stopping point and I'll reply, you'll get a better more thoughtful reply then me throwing a reply your way desperately trying to get back to actual work.
It's weird to me how many companies seem to go out of their way to create an environment where developers can't get their best work done.
I mean there has to be a degree of balance between working together and working alone but the ratio in my opinion is 20/80 for what we do, meet up, make a plan, bugger off and work on the plan, reach out of something is a problem.
Versus the type of environment I'm currently in where it's death by a thousand distractions if you allow it, which I simply don't.