Grocery stores near Glacier and Yellowstone
It just occurred to me that a chowhound holed up in a cabin near Yellowstone should have a stock of Jamie Harrison's Blue Deer detective stories. These take place in a mythical Montana county on the edge of Yellowstone. The main protagonist is the county sheriff, who'd grown up locally, but had some spent years of education and hedonistic living back East. Food isn't central to the stories, but is often in the background.
"Jules [the sheriff] was a good cook, mostly thanks to Alice back in the years when they'd lived in New York, and in the past he'd used this talent ... to seduce ... Alice maintained that he was looking for the female equivalent of lamb couscous with seven vegetables, boeuf bourguignonne with roasted potatoes and a salad of fennel and apples, followed by creme caramel; a full Batard Montrachet or Grands Echezeaux of a woman." p149, Blue Deer Thaw.
There was a thread a while back in this section about someone seeking locally sourced produce in Montana. If I recall correctly the best options close to Yellowstone were in Bozeman, which is a college town. For Glacier, Kalispell would be the best place to look. It serves an upscale vacation area around Flathead Lake.
Growing season is short in the mountains of Montana. Mountain huckleberries (like blueberries) are one of the few 'native crops' that the area is known for. They grow a lot of hay as well, but you only eat that via cattle. Some restaurants might serve local game and trout, but I don't know if you can find much of that in groceries.
I'd suggest a search via town names.