It really is a kind of existential dread I get when having to contend with this. Thankfully it's rare now that I don't have a job in an office or at all, but when I did, I'd end up with the same solution; I had to leave the office, or ironically, take a breather in the kitchen and hope they were done their meal when I got back.
It consumed my consciousness in a way that literally dropped my productivity to near zero, and I couldn't catch up, and got fired. Thankfully my boss didn't do a damn thing except scold me for being slow, otherwise I'd still be making PDF editing software.
I'd just go to a cafe down the street for a few hours, which reflected poorly on me, but I had no choice. Not only was the coffee laughably better than the shit in the office, but my ability to focus there vs the office was like night and day.