I've spent time with a friend and her family of 5 who love junk food, she needed masses of cupboard for the multipacks, packaged food takes up way more space.
Anecdotes aren't the same as statistical facts. Many people have tiny flats, some with limited kitchen facilities and almost no storage (cupboards, freezers etc).
A 'big' supermarket has it all. Online delivery is available in most of the UK
Not everyone lives near a big supermarket. Some deprived areas in particular have only small convenience stores nearby. These stores have limited stock and it's often mainly unhealthy processed food (and the food they stock is sold at higher prices than large supermarkets). Not everyone is able to drive or can afford to. Online deliveries often have minimum order costs.
The point about food restriction and deprivation then overeating, is that a) it affects metabolism, b) it's not a choice - people are literally unable to afford regular stable meals so get trapped in that cycle. Of course people who face periods of limited food might overeat or eat cheap unhealthy processed food when they do have some food.
And also psychological impact is relevant. Human beings are not feelingless robots. So yes sometimes people in horrible circumstances and who are suffering chronic stress have a psychological crutch, which is for some people junk food.
Address the causes of people's horrible circumstances and chronic stress,whether poverty or other trauma, and that addresses the symptoms (obesity, or whatever other symptom someone might have).