Even when there was just TOS, and no other series, I viewed the UESPA/UFP/Starfleet/Space Central mess as something like the way Civil War troops were called up, which (I think) somewhat survives in the National Guard. Modern day vets can please correct me, but it might work out to be something like this:
The Enterprise is owned by earth, but it's provided to the UESPA, which places it under command of UFP and its Starfleet.
Or, the primary crew was mustered on earth. Literally, then, "we" [the crew] can be a combined service" under UESPA, while the ship is "owned" by someone else, or may be on detached service to the UFP, etc. (Similarly the Intrepid, for example, seems to be a Starfleet vessel that is "owned" and crewed by Vulcan. They must have a UVSPA!)
Think of it this way: let's say that Kirk serves today, as a captain with the 128th Air Refueling Wing of the Wisconsin Air National Guard, stationed at Milwaukee's General Mitchell International Airport. Right now, he's serving overseas.
He meets a local in a small country who asks where he's from, what service he and his crew are with, where his airplane is from, etc. He could answer "America," "United States," "Air Force," "National Guard" (truly a "combined service), "Wisconsin National Guard," "Wisconsin Air National Guard," "128th wing," "Wisconsin" or even "Milwaukee," etc. (I suppose you could even throw in "Boeing" for the tanker.) All would be at least sort of true, and you don't need to deliver a complete resume or command flowchart when a quick answer will suffice. (Best canon example: "No, I'm from Iowa. I only work in outer space.")
The point I'm trying to make is that there's lots of wiggle room for everything TOS says to be accurate, just looking at today's military.