It is not realistic at all. "Up or Out."
Maverick should have been at least 27 during the events of the first film. In order to have the rank of lieutenant (Mav wore two bars in the first film, so Lt), he must have 9 years in the Navy and going ROTC would put the start of his career at 18. So 27 assumes he is the youngest possible age for a Naval Lieutenant in 1986.
According to Joseph Kosinski, the film's director, in an Equire Magazine interview, the events of the film Maverick are 36 years later and Maverick is in his late 50s:
I pitched him the opening sequence where we find Maverick 36 years later, because that’s what I think people were really struggling with, like, “What's this guy doing in his 50s in the Navy?
So Maverick is supposed to be in his late 50s and we can assume was then 22 or 23 in the first film; however, if his character was a realistic age in the first film (27) he would be 62 or 63 in the second film. Mandatory retirement age for a naval officer is 64, so Mav is okay on that front. The problem is the Navy's "Up or Out" system, under which, if you get passed over for promotion to the same rank twice, they discharge you from service. In 36 years, Maverick was promoted through the following ranks: from Lieutenant ==> Lieutenant Commander ==> Commander ==> Captain. So, just three promotions in 36 years, averaging one every 12 years. The problem is that Maverick would have had to have been passed over for promotion way more than twice for at least one of those ranks, which would have put him out of the Navy.
By my reckoning, Maverick would have had to have been a two or three star admiral (and no longer eligible to fly) in order to still be in the Navy at that point.
Mav's not the only one with a problematic rank.
Rooster was 3 or 4 during the events of the first film (we'll say 3 for the sake of argument). That would make him 39 or 40 years old at the time of the events of Maverick. In the film, he is only a Lieutenant... which means he too must have been passed over for promotion more than twice and would have been out of the Navy. Naval Officers are typically Lt. Commanders at a minimum by age 39, unless they joined the Navy much later in life. I guess that is possible, since he claims Maverick delayed his career by 4 years, but even with a 4-year delay he would have been more than a Lt at that age.