You would think with how hard it is to get into the Academy, how many qualified people they have to turn away, and with the fact that they don't have to pay for pensions in a post-scarcity utopia, that the Federation would have a more rigorous mandatory early retirement policy. Like, how many times do they let an officer be "Inner Lighted" before they tell them, "sorry, we know this isn't fair. This isn't on you. But at this point, your brain has been hijacked and influenced by alien technologies on multiple occasions. We frankly have no idea what those machines did to you. This isn't meant to be a punishment to you, but we simply cannot have someone so potentially compromised working such a dangerous position."
I'm sorry, but from a purely HR and risk perspective, after going through a fraction of what he did, Miles O'Brien should not be working as the Chief Engineer of one of the most strategically important defense facilities in the Quadrant. He could be compromised and not even know it. How do they know that time in the mind prison didn't also condition him into a sleeper agent of some sort?
After a certain amount of trauma, you would think they would just start mandating officers take early medical retirement. Not a judgment, just risk management. Hell, I would think after a single instance of an officer having their mind hijacked by an alien device, that at a minimum the victim would be transferred out of a front-line role, to somewhere where less sensitive.