The closest Trek has come to anything like that was "The Counter-click incident", which ended with the retirement age of 75 being abolished.Yup.
I can only find info on the US Military, but I imagine the rules are fairly similar elsewhere. For someone that has yet to be promoted to flag officer or general officer, the maximum time in service is thirty years unless overidden by senior civilian authority. If he graduated the Academy twenty-two (2327) then he should have retired c. 2357, several years before he took command of the E-D and over two decades before the earliest point he could have retired given known canon.