I don't know where this "lol Stalin was just too dumb to realize Nazi Germany wanted to invade". The Nazi State was explicitly anti-communist and heavily racist towards slavs ever since it came to power, and the only reason the Molotov-Ribbentrop Pact even had to be devised was on account of Britain and France's utter refusal to work with the USSR. Not to mention Britain did essentially the same thing with the Germans during 1938 as the Rhineland, Austria and Czechoslovakia were invaded
Preparations had been made even before that to prepare for full-scale invasion, albeit not for Nazi panzers, but for another coalition of capitalist-imperialist forces. Earl Meade, a bourgeois military historian writing during the war, has a very good take and sheds light on the Red Army/Stalin's decision making:
"The German campaign in France in the spring of 1940, which was not that different from the campaign of 1939 in Poland, provided the Red Army with a blueprint of the attack against them which was to come a year later. The Germans, the Russians reasoned, would depend upon surprise and speed, aerial assault upon communications and services of supply, mobile warfare aimed at encirclement and annihilation-the most gigantic Cannae in all history. Hitler was determined to try what Falkenhayn, Seeckt, Leeb and other had always thought could not be done-to deliver a knock-out blow to Russia within a relatively brief time. The Russians were reasonably sure that unlike the Low Countries they could not be overrun and that unlike Poland they could not be paralysed by by aerial assault. But they knew that they had a prodigious task on their hands of meeting an invasion of such tremendous scale and intensity. It is doubtful, however, that they could have imagined even vaguely the purgatory through which they were to pass before, in the summer of 1943, they could seize the initiative.
What the Russians had to do was fairly obvious. They had to keep the Red Army intact, “in being,” at all costs. They had to avoid encirclement as far as possible; such units as could not escape were to resist to the last. They must trade space for time-that is to say, they must bring about protracted war by compelling the Germans to punch deep into Soviet territory without obtaining a decision. But the territory which the Wehrmacht acquired must be made virtually useless by wholesale devastation and rendered insecure by incessant guerilla warfare. The resulting warfare of attrition and extended lines sooner or later would give the Red Army the great opportunity for which it had been trained and indoctrinated ever since the civil war-the opportunity to destroy the enemy by an offensive. “according to the {new} Soviet concept, blitzkrieg came at the end of the war, not at the beginning.”
In evolving a strategy of retreat for 1941 the Red Army was completely unaffected by the defeatism of Weygand and Petain, but rather was adopting the policy of active defense which ha been ably advanced by Field Marshal Ritter von Leeb of Hitler's Army. The facts of geography and the force of historic tradition must have been almost equally persuasive. Space and cold and rain and mud have always stood in the way of the would-be conqueror of Russia-natural barriers perhaps even more formidable under the conditions of mechanised war, than rivers or mountain ranges. When the storm broke over the Soviet Union in June, 1941, the minds of people everywhere travelled back to 1812, the name of Napoleon was on the lips of millions. "
- Lenin, Trotsky, Stalin in Makers of Modern Strategy – Military Thought from Machiavelli to Hitler, Edward Mead Earle (ed.), Princeton University Press