As I recall, the timing of his battlefield assumption of command was dated to 2333 in "Tapestry," and Jack Crusher was killed under his command on the ship in 2354. A year later, the Battle of Maxia happened and she was presumed lost.
I have always wondered if Picard actually immediately gained command of the ship in 2333, of if there might actually be a loophole through which he gets to become XO before gaining permanent command. He was a Lieutenant Commander at the time, and twenty years is a long time to command a ship.
Well, 20 years is a lot, but long tenures seem pretty common in Starfleet. Pike had Enterprise
for at least 10 years, Kirk had her for at least 10 (and longer if she became his personal flagship), Picard had the E-D for at least 8 years and would've been longer had the ship survived, and then commanded her successor till at least 2379. Starfleet doesn't seem to have an up or out policy, particularly given that evidently you can stay a lieutenant jg for 40 years ("Tapestry), so I guess letting a captain have a ship for super long duration commissions makes some sense.