That is actually why Hitler had an incursion in the USSR while waging war in North Africa and the Atlantic, creating an anti-Hitler coalition and thus having no chance of an outcome that isn't a catastrophe for Germany. Surely an unwise decision.
The Soviets knew in advance of the invasion of the USSR but Stalin could not believe that the Germany could do such thing. Not because he trusted Hitler, but because such a decision would be stupid - Hitler himself claimed that war on two fronts was unwinnable for Germany since WWI and because he didn't see an adequate preparation for an invasion - sure you have troops near the border, but they were in no way prepared for Russian roads, Russian winter or the Russian distances. There was no way Germany could defeat the USSR before winter sets in with no planning.
Stalin planned an invasion of Nazi-controlled Europe, before the Nazi invasion of the Soviet Union. But the Germans had their invasion a few weeks before the planned. But since the troops and materiel were prepared for an offensive war they could react adequately in the beginning. The Russians had only bombers and a million trained paratroops - this is definitely a preparation for an offensive war.
The Germans couldn't achieve any major objective in the USSR anyway:
* they didn't destroy the Russian industrial capability: Moscow and Leningrad weren't taken and behind them you have the Volga and Ural areas, which produced materiel and provided manpower which let the USSR win the war and conquer for itself half of Europe. Plus even much of the plants that were in Ukraine and Belarus were evacuated of their skilled workers and expensive machinery and new ones quickly were formed deep behind the lines of combat and the ranges of Wehrmacht air power.
* no major resource was lacking in the USSR - certainly not oil, which was one of the critical ones. Germany barely had enough from Romania for its own needs. France, the Balkans, Northern Europe, North Africa were invaded with Soviet provided oil, thanks to the Ribbentrop-Molotov pact.
* they didn't isolate Russia politically - they couldn't convince the Japanese to attack them in the back while Soviets had instant allies - Britain and United States which generously provided even more materials and technology.
And this was exactly because the war was started by a logical, sane author.
Stalin overestimated Hitler, thinking he wouldn't do such a thing. Germany had no realistic way of winning a war against the USSR with those conditions. I am not saying that USSR was unbeatable. Just that the Germans didn't have a feasible plan to do it and it was obvious to Stalin.