One exception to this, in the Navy, is command of medical ships, which does go to Captains of the Medical Corps. So Dr. Crusher's command of a science vessel does have precedence in real life.
US Navy hospital ships are Military Sealift Command fleet auxiliaries (USNS prefix), not commissioned naval vessels (USS prefix) and have a civilian crew headed by a civilian master mariner. The senior medical corps officer is in charge of the hospital located on the ship with a title something like "Commander, Naval Medical Facility, USNS Comfort
." Not "Commanding Officer USNS Comfort
." The medical CO does not get involved with running the ship and the master does not get involved with running the hospital.
There was a period in the early 1900s when medical corps officers were put in actual command of USN hospital vessels. This caused difficulties because officers who had been trained to command ships at sea did not like to be given orders by officers without such experience. After WW1 there was a court-martial of a line officer who refused to sign a log in a disagreement with his medical corps superior. The line officer's actions were upheld and the rules were changed. Thereafter, as long as hospital ships were USS vessels, a line officer was in command. A very interesting account of the court-martial can be read here:
As for Sisko and the "command track," Trek has shown pretty consistently that "command division" does not necessarily indicate qualification to take command, and officers from the science and engineering/services/operations divisions can still be "command track." Sisko was probably on that track from early in his career, if not the very beginning.
From what I understand, the red uniform covers all personnel who control ship functions or command. Tom Paris in Voyager had no subordinate staff, but as the helmsman wore a red uniform. Similar is the case of Worf in TNG season 1 (I guess as Tactical Officer his role was a control one).
I think also as in the real life armed forces, those officers who stand out become heads of departments, XOs and COs.