There are some works that require one long uninterrupted time. One of them is writing. And I think included here is writing code.
It won’t be a simple addition. If you write for 2 hours, then having interrupted, then you write for another 2 hours, the result will be different if you continuously writing for let’s say only 3 hours. You may add another 2 hours for interrupted work which in total that will take you 6 hours to write.
I won’t say that going out with my son isn’t fun, but on a certain task, I do need uninterrupted time just to get things done.