The ending was realistic enough. The actual government would have to either release a bunch of civilians or give them a trial, which would risk a lot of paranormal secrets and the nature of their actual activities in Hawkins coming to light. They probably also wouldn't want to draw attention to how their gates were defeated by a middle school science teacher, or how they thoroughly lost a gunfight to Hopper and Nancy Wheeler.
What it wasn't was consistent with the government as it functioned in the Stranger Things narrative, and other paranormal conspiracy narratives, where the government is always infinitely vast, infinitely competent in shady conspiratorial crap, and completely ready to disappear two dozen people without a hitch. Though, to be fair, the government just releasing people because "nobody will believe them" is also a staple of paranormal conspiracy narratives (because it's usually part of the stories of the people who originate government conspiracy stories).
And no, it's not that I don't think the government is up to all sorts of shady dealings, it's just that actual government conspiracies tend to be small and simple. The vast conspiracies we see in fiction require more hyper-competence and loyalty than large bureaucracies with crappy pay can command.
The easiest narrative solution would have been to contrive a death for Dr. Kay for some sort of Upside-Down collapse reason, and to have established a normal, non-evil conspiracist, soldier as her next in command on the scene of the protagonists' capture (or give Dr. Kay some nuance as a character which would lead to her letting them go). I also think they generally should have distinguished a subset of the military forces there, Akers' unit, as being the elite force of hyper-naughty words who can be killed with moral impunity, rather than just having our heroes treat any and all soldiers assigned to Hawkins as a faceless goons to kill. And they should have used Kali's illusion magic to get past the soldiers at the end of episode 7 rather then gunning a bunch of them down.