No, it was being bogged down in Poland trying to force August off the Polish throne for six years that laid the foundation of the Swedish defeat. Peter spent those seven years rebuilding his army and slowly and surely training it by going after the Swedish fortifications in Ingria, Estonia and Livonia. Despite this, his forces were crushed at Holowczyn 1708.
While Karl XII's basic idea of forcing August off the Polish throne and getting someone that could aid him elected made grand strategical sense, it was a failure as a whole. The Swedes spent too much time and too many men fighting in Poland, while the Russians were re-building a western style army, and in the end, no help from the new Polish King ever materialised.
Karl XII should have marched east 1702, after the occupation of Courland. Peter also had problems with the Crimean Tatars and the Ottomans and had little of an army to throw in the way of Sweden. Being defeated inside Russia (perhaps at Pskov?) could perhaps put him at the mercy of the Strzelsky and others that did not really like his reforms.