Wasn’t there a children’s story that was written using this theme? I think it was The Little Red Hen. She saved food, she built a sturdy house in a safe place, and none of the other farm animals wanted to help her. Later on, when something big happened, I don’t recall, maybe the Farmer died, the animals are adrift, desperate and hungry. Now they knock, knock knock on the Little Red Hen’s door, hoping to move into her place, having done none of the work and sacrifice she did to make these events happen or be maintained.
The Shelter (Twilight Zone)
https://www.youtube.com/watch?v=Zm6cMdePtMA
That sounds like the Aesop fable "The Ant and the Grasshopper".
In the Little Red Hen she planted the wheat, watered it, weeded it, harvested, ground it and baked it into bread. At each stage the other farm animals refuse to help only to show up when it comes time to eat the bread. Ha, suckers, no bread for you.
The primary difference is that in The Little Red Hen the bread is merely a tasty treat without the implications of starvation in The Ant and the Grasshopper.