There are one or more Super Advanced Civilizations in the universe, who have largely gotten past things like war and resource shortages and the like, and they've set themselves up as guardians of the universe, protecting the peace against races that might try to blow things up. They prefer a light touch, though, having had their own version of the Prime Directive develop after some disastrous attempts to steer development. For the most part they let races alone...unless the race is deemed "insane" by their standards.
The primary life form of a world is judged as they're starting to do things like recognize the patterns of stars in the sky (assuming they have the sensory apparatus to allow this). If deemed insane, their entire solar system is moved into an asylum galaxy. If they ever prove themselves sane, they'll be contacted and plucked back out. But until and unless that happens, all the insane races of the universe get to share a single galaxy, bounded on all sides by a barrier that will prevent them from escaping should the develop a superior sort of FTL. And should any race inside the asylum reach singularity, the entire galaxy is set to implode as a failsafe.
Thus the sort of crazy races seen in cosmic superhero settings would be explained as being all the madmen of the universe, left alone to cure themselves or kill each other off. The guardians don't much care, so long as they stay inside the walls and don't infect the sane races of the universe.