Chaosmancer
Legend
You're positing a world where the only way to survive is to retreat behind stone walls every night no matter if you live on the edge of the wilderness or in the middle of an otherwise stable and wealthy kingdom. One where if you stay out at night you'll be eaten by hungry monsters that for some reason ignore livestock and, even though they are obviously starving won't hunt during the day. A world where an orcish horde can invade at any moment, but they leave crops alone. One where halflings (because they are not elves or dwarves) are left defenseless.
Of course the hungry monster eats the livestock. What does it eat next though? What, you think a monster that eats a few pigs will never get hungry again?
The point isn't that everyone will die if they are out at night, but that the world is incredibly dangerous, dangerous enough that not having a proper defense plan in place does not make sense.
Do orcish armies invade? Yes. Same way that armies have invaded for millennia. Do all commoners in your world retreat behind stone walls every night? Well, then the halflings will probably be right there with them. In my campaign, in any campaign I've ever been involved with, there has been the assumption that many commoners live in the countryside. They might have simple fences to keep wild animals out of the barn and a bar across the door at night, but that's it.
If halflings don't work in you world, fine. From every campaign I've actually played in real life it's a pretty atypical one unless you're talking video games ... but that's a different story. Most video games have a silly concentration of monsters simply because of the nature of travelling from point A to point B and expectations of not travelling for a day or two (or longer) with nothing to do.
There are too many threats in DnD. Too many things that are too big and too dangerous. And halflings could survive and defend themselves. But not as presented. As presented they are even less well defended than the humans, and the humans stretch believabilty. But everyone just keeps insisting that the problem is me.