I think learning to work around interruptions is a skill that can be developed over time.
Just watch some coding streamers on twitch. They can start and stop their coding while interacting with their viewers.
In many ways it's the similar for gamers on twitch. Try holding a conversation while playing a game. Over time they learn to be good at both simultaneously.
There are going to be some programming tasks that are harder to start and stop. But for most programmers those are going to be the exception.