(Am I the only one who thinks it would be funny if Baris later went on to become Federation President? The image of Kirk having to salute the guy as his commander-in-chief would amuse me greatly.)
Now I'm sure that you're going to write a long and articulated response to this Sci as to why I am wrong, but the Federation President is not the Commander in Chief of Starfleet.
The Federation President is explicitly called Starfleet's commander-in-chief in DS9's "Paradise Lost."
(There, now, that wasn't too long and articulated, was it?)
As The Undiscovered Country showed us in the briefing before Enterprise rendezvous with Qo'nos One, the CnC of Starfleet is another, although very high ranking Starfleet officer and not as you believe the Federation President.
"Commander-in-chief" is a term that can occur multiple times within a hierarchy. The commanding officer of the U.S.'s unified combatant commands used to be called "commanders-in-chief" of their UCCs even as the U.S. President remained commander-in-chief of the overall armed forces.