My guess is ostensibly working out of Starfleet Command, but seconded as some kind of Starfleet Liaison officer to a variety of Federation diplomatic missions and embassies. That would let him get to know everyone and make him a natural candidate for a high-profile job like command of the Enterprise. It's also a useful background (when combined with his known tactical/combat/improvisational skills from the Stargazer Incident) given the Enterprise's intended role exploring deep space, making contact with new species and effectively acting as the Federation's voice in those contacts. You need someone diplomatically reliable in that role.
Yeah, I'd agree with this.
There is a line in BOBW where Riker says that Picard "wrote the book on this ship". If they all came aboard at the same time, how is it that Picard knows more than Riker and Data? He must have had extensive knowlege from his previous posting. If he had worked for SF Command, he would have been able to keep an eye on the Enterprise while it was on Mars and try to win the command of it. He would have admired the ship and found out as much about it as possible, perhaps even visiting often and giving his input.