We don't exactly know the time frame in which Picard's assignment to the Ent-D spanned. We do know that it was a year after it was launched from the Utopia Planitia shipyards that he actually took command. He could have been in line for that posting long before the ship was commissioned or even completely constructed, and taking interim postings
As for the years awaiting his next command, there's been some good theories here, the space station he displays in his quarters, working for Admiral Quinn. Picard apparently conducted at least one inspection tour (& probably others) where he first met Geordi, & decided he wanted him on his next command
So in short.... he was working for Starfleet, waiting for another ship, or perhaps the best ship he could get, which would certainly take some time. Starships don't grow on trees, but try telling that to Will Riker
I would think that commanding the Stargazer for 22 years, with distinction, and found innocent of any wrong doing connected to it's loss, would be consistent with considering Picard a captain of the highest standing, such that with the proper patience & maneuvering he could land the new galaxy class flagship