Yes, that’s how you should live if you want to be healthy. If the place where you live doesn’t allow that, then you’re sacrificing your health to live there.
That’s your choice at the end of the day, but don’t make excuses for why you choose to eat garbage all day.
Being able to just up and move to a place that makes it more viable to grocery shop multiple times a week involves a certain level of affluence that a lot of people don't have.
It is not a generalizable answer to this problem.