The President has the authority to directly appoint officers in the Military. Below the “Flag” rank (Generals and Admrils), there is no congressional review. So President Trump could directly appoint Gallagher to O-3 or O-4, direct that he be assigned to some “retirement” job at some small base or station near where Gallagher plans to retire.
If Gallagher holds that rank for 12 months, he would retire with that rank and paygrade ... not as an E7.
Well and good, but not for the benefit of the services.
Actually, unless the laws/regs have changed in the last decade, 24 MOS TIS/TIR is required for retirement at the last rank/grade held.