What I believe happened is that the creator of Babylon 5 went to Paramount with his ideas for the show and Paramount chose not to make it, but turned around and made a Star Trek show with the same concept. DS9 ended up premiering first, but it seems like Paramount may've ripped off the idea for it.
That's the tougher debate for me, I recently stumbled on the Babylon 5 box set with all the movies and Crusade. I watched through the whole series and yeah season 1 struggled, but then it jumped into the Shadow War and then the Earth Civil War, then the last season was flat because they didn't expect it.
But it was a brilliant piece of television, with awesome acting from the start. The season 1 and 2 special effects are clunky and video game like but after that they do hold up pretty well.
Deep Space 9 is a prettier looking series from the sets to the CGI, it looked like money was spent. The later massive ship battles was awesome to watch as well. The acting from the start on deep space 9 was top notch. Like Babylon 5 the first establishing season to season and a half was a struggle and then they got into the Dominion and things took off.
I love both series equally and really they're head and shoulders above any of the other Trek series.
The important thing with Deep Space 9 and the reason why I enjoyed it so much was that it went away from the Gene utopian soceity theory where everything was pretty awesome or if bad fixable bad. At times Start Trek feels like its trying to lecture its viewers and hit them over the head with this notion of a perfect humanity. Sure it had flawed people but they could be fixed in 20 minutes with 2 commercial breaks.
Deep Space 9 changed that. Humanity and the Federation was flawed, there were different personality types and they were willing to cut corners and do unsavory things for what they saw as the right reason. we saw attempts by Federation officers to over throw the government in the name of security. We saw a Federation Captain creating a lie and murdering people to gain fire power. We saw terrorists and we saw cowards. We learned that war was still a real thing and it wasn't fighting against an easy to define enemy like the Borg. We saw deaths in the trillions and the writers weren't afraid to kill or hurt cast members to drive points across. We saw that the Federation certainly wasn't perfect and far from unbeatable.
Even the enemy, the Dominion, you could have some sympathy for the enemy. The Gem'hadar (sp?) were slaves and victims and throwaways and so were the Vorta. Even the changlings, had a easy to understand reason to fear and hate the rest of the galaxy and saw their reasons for war as somewhat noble.
Deep space 9 turned Trek on its head and shook it and some Trek fans hated that, they wanted to Gene concepts and endless exploration and a flawless empire of man, so we got Voyager and then Enterprise.
Discovery really tried to emulate some of the themes of DS9, but that failure has been discussed here over and over again.