I remember the weekly shopping cadence growing up in a relatively rural new england town, but there was still always the inevitable "milk run" when you ran out of something unexpectedly. With smallish high rise condos it's hard to store a lot of food (kitchen designers assume you don't need a pantry or full size freezer for some reason).
Another factor is that in this age of instant gratification if I were to buy a week's worth of perishables items would go bad because it's so easy to have a shitty day and say screw it, let's go out, get takeout or get delivery (369 restaurants will deliver to me via uber eats) instead of cooking.
Not saying that it's a healthy way to live, but it's become a strong pull over the 10 years since I've made the transition to fully urbanized life. The way we cope, especially after having a baby, is to shop at the local butchers, bakers and markets for fresh stuff every few days and order delivery of heavy bulk goods periodically.
Accidentally running out of flour, coffee filters, half and half, etc., is probably an inevitable side effect.