My Little Pony and Friends/WMG

The Rainbow is an unmanned TARDIS
It makes perfect sense! One of the Time Lords was experimenting with a new kind of TARDIS. He built a remote control which would operate it. He did this hoping to merge his original TARDIS with this one in order to hide from the other Time Lords, because no one would ever thiink to look for him inside a rainbow! But he was killed by the Doctor before he could complete his work, and right when he was just about to test it. The handheld controller he made for it was lost and the prototype Rainbow TARDIS was left open. The last known setting he had put it on was set for Ponyland.

Dream Valley used to be just like Mordor.
Hear me out on this one. The current, Sugar Bowl niceness of Dream Valley is actually a relatively recent change made by the ponies, themselves. Predating that, the various evil overlords, demons, and other borderline Eldritch Abomination monstrousities were in complete control. In fact, them and their empires were the population. The primary source of sports and reaction were constant wars of Evil Versus Evil. They usually held them on Tuesdays.

So this is why the ponies have to deal with so many villains all the time.

Megan is at fault for all the evil roaming Ponyland, but not intentionally.
Each time she or one of the ponies passes through the dimensional rift between present day Earth and Ponyland, it allows dark creatures to cross into Ponyland. Nice Job Breaking It Hero.

The Dream Valley of My Little Pony 'n' Friends exists in an alternate dimension than the Dream Valley in the My Little Pony TV Specials within The Multiverse
Exactly What It Says On the Tin

All the segments take place in the same world. Just different parts of it.
Despite what that one song might tell you, it is not a small world after all. If the pony, glo friends, moondreamers, and potato head kids were all just in different places on the same map, it would certainly explain a lot.