also, let's not forget that Trek has NEVER been reaistic on the military aspects. Officers doing enlisted men work, "flagships" without flag officers, officers who stay as captain or XO of a ship for a decade or more.
Trek's military is nothing like a modern military.
You don't need a flag officer for a ship to be considered a flagship.
Two of the definitions of the word flagship are
(Transport / Nautical Terms) a ship, esp in a fleet, aboard which the commander of the fleet is quartered
(Transport / Nautical Terms) the most important ship belonging to a shipping company
It is the second definition of the word that is being used when they say the Enterprise is the flagship of the fleet.