And what on earth makes you think that living underground isn't a countermeasure? What makes you think that close knit communities full of people with accurate ranged weapons aren't a countermeasure? Just because halflings don't make a big song and dance about it doesn't mean they aren't there.
Halflings don't live underground. They maybe live underhills with surface accessible doors. They don't have darkvision.
And they aren't that much more accurate. They only have +2 Dex.D&Dcan play it up but it's just a +1 modifier. 5e even took away their racial and size attack and AC bonuses.
Sucks to be the orcs I guess.
Yeah. Theorc lore is just as silly and stupid. You cannot sustain on raid and raze pillaging. No less their level of muscles.
Here's the thing. Gnolls don't get any sort of bonuses either - and have a lower default AC.
Far from sucking mechanically halflings are as strong as hill dwarves, elves, or most humans. They've a higher AC than gnolls while being as accurate and doing as much damage in melee with a shortsword or scimitar as a gnoll does with their spear. An average halfling stands a pretty good chance of being able to 1vs1 an average hill dwarf under normal conditions, being more acccurate both in melee and at range even if the dwarf has a couple more hp.
The idea that halflings suck mechanically is something that you seem to have invented. Dex is the god-stat in 5e and halflings don't actually take significant penalties from being small in 5e.
Remember that 5e is not 3.5. In 3.5 halflings had a penalty to Str - and strength was important to both melee and ranged damage. In 5e halflings do not have a penalty to Str - and they can use Dex for both melee and ranged weapons. They don't need a size bonus to attack rolls because their damage isn't pathetic. And with bounded accuracy that damage just about always matters.
Gnolls get +2STR, have 5HD in 5e, and get a free attack when they kill a commoner..
Being small is almost purely a disadvantage in 5e. It;s only advantage is in squeezing and finding hiding spots.
Dexterity is the best stat in 5e but that is under the assumpton of a PC. Low amounts of Dex, the amount a NPC would have, would not greatly increase their survivalibility. Add in a lower penchant for magic and martial pursuits and PHB halflings are a worldbuilding nightmare if you look at them too hard.
Now,fixing it is really easy. You don't need to make them super magical or all knight or anything. However there is a lot of pushback to bringing halflings down to the same level of ridiculousness of humans, elves,dwarves, tieflings, and the like.