Food deserts happen because businesses don't see enough paying customers to justify the operating costs of setting up shop in that neighborhood. There's only a few reasons for that. Literally not enough people live there*, a surplus of non-paying customers**, and excessive regulatory burdens*** come to mind.
I think there's another potential reason that you're not considering.
In densely populated urban areas, even where rents are moderate, the cost of real estate needed to build and operate a full scale grocery could be prohibitive.
Small convenience stores and the like might have a bank of refrigerated display units for cold sodas and beer and a pint of ice cream. But they don't have a need for large storage of perishables. They might have a walk-in fridge or freezer in the back for extra chocolate milk or popsicles, if they're a fancy store. When goods are delivered, it's a few boxes or maybe a pallet of something popular delivered by truck.
Grocery stores have many times the number of open-front refrigerated storage for in-aisle goods, as well as many more frozen units. They also have entire refrigerated and frozen rooms where the stock is stored. They have meat lockers, dairy and egg storage, etc. When goods are delivered, it's an entire semi truck of food.
So not only do groceries need much more square footage than a corner store, they also need significantly more robust storage and delivery capabilities, and they need more industrial electricity and cooling systems.
If the property values in a given area are too high and the streets too narrow, there's likely not a good way to make it happen even at break-even pricing. So large grocers end up further away, in an area where they can get the needed floor space and power to function.