The simple answer is that Napoleon's objective was neither Moscow nor St. Petersburg. His objective was the Russian army. He would maneuver against an enemy's capital in order to force the enemy army to defend it, but again, his objective was the Russian army, not a city nor a capital.
Sincerely,
K