Depends how bad you want to beat this. ..control all the variables you can ☺ (try only developing in public: open rooms, with your partner around, etc)
As far as nofap is concerned, how would you differentiate actually watching porn and imagining it? The effects are the same.
Yeah you're right, I think my main problem in life is actually internet addiction. I've learned through self-reflection that all of my other vices (save for sugar) stem from me wasting time on YouTube and Reddit. It's true that I need to cut it down, but the urges are literally surrounding me everywhere in this world. Quitting that monster is a whole other beast to tackle.