What has worked was showing her the bill for a monthly office lease. I said I cannot do this any longer so I rented my own office outside of home. First she was very angry that I spent money like that "because you can work from home!", but I said that I can't because she doesn't respect I can't be interrupted. She promised that she will try not to do that if I cancel it. I did cancel (although I lost the deposit), but she stopped doing this. We agreed that I cannot be interrupted between 9 to 5 except lunch time.
Classic example when money talks :)
One answer on the actual post that I found interesting was the analogy to falling asleep. For most people, that takes X minutes. Let's pretend that is 10. It seems pretty relatable to say that if I am falling asleep and you engage me with questions about something that this timer resets. It will now take me X+ minutes to fall asleep. Everyone has been interrupted when trying to fall asleep so I think at the least it would provide empathy even if they can never fully "get it" as to why it takes 10 minutes to get into the zone.
I think the other thing that people could understand is that part of developing involves moving the code and systems you are working on into a complete and active model in your brain. This is why the loading time is required so you can then leverage this model to plan and make changes.
Going to a coffee shop and putting headphones can be more productive
Of course, it makes sense if you really think about it. In a coffee shop, no one is going to come up and tap on your shoulder and ask you some stupid question they could have asked in email, nor do people generally have loud, annoying conversations right next to you there. There's plenty of people in a coffee shop, but they're strangers, they keep to themselves, and they don't talk except perhaps to their singular companion in a quiet manner.
I've been through the "explaining" phase of trying to help my spouse, who cares a lot about my ability to do my job, and yet is a prolific interrupter, "get it". It hasn't worked for me. It leads to bitterness and arguments.
The healthy solution: If you need peace and quiet to concentrate, like me, get yourself your own space. Start going to a different room to concentrate, or a co-working space (if you work from home). Depending on your job, you might only need a certain percentage of the day for solid concentration.