But TOS wasn't set on Earth. It was set out on the rugged final frontier, where, yes, there were famines and epidemics and massacres and border skirmishes.
That's the key to understanding Trek, that it blithely declares Earth and the Federation to be a paradise and then procedes to largely ignore both and focus on the fun, dramatic part of the galaxy, the frontier of the Federation and beyond. Paradise is boring and doesn't make for good drama, but it does make for a good rationale to root for Our Heroes shooting aliens because they're defending paradise, dontcha know?
And that's something all the series have in common, even to some extent ENT, which really missed an opportunity to show a pre-enlightened Earth.