Exactly my point! That's one of the biggest reasons such regulations exist in real life.I imagine it's against regulations for you to have a lover under your command but Starfleet has a history of turning a blind eye but this episode shows why that is a TERRIBLE idea.
Though there's no indication one way or another in canon whether Starfleet has such, in real life militaries there are such things as Warrant and Limited Duty officers, who basically stick with a single specialty throughout their careers (and who will never be eligible for Command-at-Sea of a warship, but are eligible for Command Ashore, in the case of LDOs.)If you want to just work the transporter or stick in one job, you take the O'Brian path and serve as an enlisted man.