If you use a social network long enough it really becomes extremely hard to do.
I honestly find it harder to quit all social networks than quit some drugs.
I uninstall/reinstalled the same social networks sometime multiples times a day, I often closed a social network webpage only to instinctively retype the url seconds later.
The only thing that kinda works for me is software that block all social medias.
I suggest you read "Hooked: How to Build Habit-Forming Products.".
I've found long term success in getting off of Facebook (never used Twitter) using the following steps (I still visit Insta most days on the native app however):
* Got rid of the native apps (except for Messenger Lite) years ago
* Switched to mbasic.facebook.com in the browser
* Recently I logged out of said mobile site
Now every time my muscle memory goes to facebook.com it asks me to login and I close the tab. I don't miss it at all and have no urge to login once I see the login form. I think I may have finally quashed my FB addiction!
Personally I dislike – even resent – having to own a device I don't like, that I don't control (not without extensive hackery, which I don't have the interest or time for), and where I have to create accounts and accept various EULAs I don't like to use basic functionality.
Of course, you can go the Replicant/PostmarketOS/etc. or Purism/PinePhone or whatnot route, but then you're missing out on so many things and/or have to spend so much time on things (not worth it for me) that you might as well not get a smartphone. A smartphone is greatly reduces in value if your banking app and $popular_messenger_app doesn't work. And besides, it only solves part of the problem: I still have a device too large to comfortably use, in spite of being quite tall with big hands.
It's hard to resist. It's like being on a diet/fasting but having your cabinets stocked with all unhealthy food or a drug abuser with free drugs they can't have.
Self-control and discipline also take a lot of mental energy out of some people.
If you set yourself up not to need to exert this discipline, like in your example of keeping junk food out of the house, that's a burden off your mind.
That's mental energy you can use for other things.
(This simple analogy of requiring exhaustible mental resources for discipline doesn't necessarily apply to everyone. But there are some people it does apply to.)
https://en.wikipedia.org/wiki/Precommitment