I don't think that Gandalf had really figured it out himself -- he was just heading 'toward Mordor' and trusting to the 'luck' of Frodo and the will/providential plan of Eru. It does say somewhere in the "Council of Elrond" (does it not?) that Aragorn was headed toward Minas Tirith rather than Mordor -- certainly Boromir was headed that way, so the Fellowship would have been sundered at Parth Galen come what may.
But Gandalf's Fall in Moria was more important in that it left him 'free' to be active against Saruman and in the defense of Minas Tirith. If he
had gone with Frodo and Sam into Mordor (and he would have probably insisted, and they would have been nuts not to agree!) they would have been much more easily found by Sauron, and even if they had won through to the Cracks of Doom, Rohan and Gondor would have fallen.
EDIT -- hmm and drat

Saucepanman, you cross-posted with me and put up a much better and illuminating post. Everyone, if you're still reading this post, ingore it and go back one.