I agree with you, but billets on Federation starships seem kind of flexible.
Up to a point. Which is why you've got to take into consideration the rank of the First Officer and sometimes Second Officer.
LaForge was a chief engineer both as an LT and LCDR, for instance.
LaForge replaced a LCDR, and was promoted
to LCDR almost immediately (it took him six years to make JG and 8 to make ChEng), so that doesn't really help.
Ditto with Tuvok and security chief. And Tom was helmsman both as ENS and LTJG (no reason why Harry couldn't have been the same).
And even counting only his
second Starfleet career, Tuvok had been in Starfleet for
twenty-six years when he was promoted to LCDR, so that doesn't really help. As noted above, Tom
is a good example for ENS to LT doing the same job, so promoting Kim during 2376 while Tom was demoted would have added some "punch" there (particularly if it was JG-LT so it would "stick").
Troi was LCDR and CDR, and Data likewise should have gotten his third solid pip (right after BoBW, for, you know, SAVING EARTH FROM THE FRICKIN' BORG).
Troi got her CMDR rank because she qualified outside of her role/billet so that's a little different. There are a couple times when Data could have been promoted (During
Family,
Chain of Command (acting XO), transfer to the E-E,
Nemesis) however I agree with the general point that he
should have been promoted at some point, with nearly
twenty years of service in Starfleet by the time he signed on as Second Officer for the
E-D (about twice as much as Will Riker to same period, and twice as much as Janeway had when she took command of
Voyager).