For me, being able to handle interruptions and then refocus is something that can be strengthened with practice like many other skills. I used to be very much in the camp of trying to avoid distractions and interruptions, but over the years my strategy has changed. My pov now is that it will happen and it will happen at the most inconvenient time, so i try to keep my work in a state that it can retrace my steps easily and make it easier to "load my context" when I resume. Sometimes this is a unit test, a random comment or whatever notes i'm taking at the moment.
I'm really not a multi-tasker and i have horrible short-term memory, so I've pretty much always relied on leaving a trail of breadcrumbs for myself.
Also take advantage of being pulled away and coming back to a work in progress (finished or not). Sometimes, just a few minutes break and change your perspective slightly.