Acknowledgement: Thanks to DrZ214 for finding a valuable source which greatly improves upon my original answer.
Short Answer
From at least the early 1920s, the Soviets were very aware of the vulnerability of much of their industry located on their western border, but plans to actually move industry out of these areas were limited. Rather, the planners' emphasis was on shifting investment in the construction of new industrial facilities to regions deeper inside the Soviet Union. Although this did eventually happen to some extent, the shift was inconsistent and often not far enough to be out of reach of the Nazi invaders.
Details
Concern about the location of Soviet industry reached the highest level of government even during the time of Lenin:
Lenin himself feared the Soviet Union’s
dependence on a geographically insecure industrial base, arguing that
‘we must not depend on regions located under fire or in direct military
danger. We must, even while developing those regions, withdraw into
the heart of the country. The Urals must be our powerful industrial
base’. The Civil War had taught a clear lesson about the vulnerability
of industrial regions in Ukraine.
Source: David R. Stone, 'The First Five-Year Plan and the Geography of Soviet Defence Industry'. In 'Europe-Asia Studies Vol. 57, No. 7' (Nov., 2005)
These concerns were also evident among the Soviet military leadership. Of particular concern was the heavy concentration of industrial production in the Petrograd (Leningrad) region:
In June 1926 a memorandum on mobilisation planning for industry in the
event of war already assumed the need for evacuation of industry from
threatened zones in the event of conflict, and urged a halt to any
further expansion of military industry in border regions.
Source: Stone
Unsurprisingly, plans to move industry (i.e. investment and jobs) were met with resistance by those regions which would lose out. Also, there were disagreements on where to relocate: some argued for eastern Ukraine, others for the Urals and others for Siberia. Despite this, relocation became official policy in 1928. Thus,
In ‘threatened regions’, consisting of ‘the North-Western region
(oblast’) of the RSFSR (except for Karelia), Belorussia, the western
part of Right-Bank Ukraine, Moldavia and the Crimea’, new restrictions
were placed on industrial development. All new construction must
ensure that enemy conquest would not excessively disturb production in
the rest of the USSR. There were to be absolutely no new military
factories anywhere in the ‘threatened’ regions, including Leningrad.
In all areas except Leningrad, development of heavy industry was to
cease almost entirely. Large new metallurgical and metal working
plants were forbidden, and electrical and chemical factories were
likewise to be constructed only in internal regions. Restrictions on
light industry were nearly as harsh.
Source: Stone
Further,
...the Central Committee finally on 15 May 1930 approved the
construction of the Ural – Kuznetsk Combine. From that point,
investment in Ukraine clearly suffered by comparison with the
burgeoning industrialisation of the Urals.
Source: Stone. Note: Reading further into Stone's article reveals that Eastern Ukraine suffered much less as there were no investment restrictions in the east.
Those were the plans, but the reality was often different. For military industry,
Production in clearly threatened western regions, despite investment
restrictions, grew sharply in absolute terms and even increased
slightly in relative terms: from 28.08% of production in 1926/7 to
29.82% in 1931. More easterly regions reached by the Germans during World War II accounted for a declining share of production: over 35%
in 1926/7 and 1927/8, falling to under 30% in 1929/30 and thereafter.
Industrial production furthest east increased slowly, from 36.51% in
1926/7 to over 40% by 1931....
...the Soviet government was relatively successful in redirecting
industrial investment, but far less successful in seeing that
translated into a shift in production. Put another way, there was a
great deal of inertia in Soviet defence industry. Changes in
investment policy to direct defence industry east had limited effect on
the distribution of production.
Source: Stone
Regions deprived of investment in new facilities relied on more labour to maintain production. Also, the new regions didn't just require new industrial structures, they needed investment in housing, transport networks, power and water supplies etc. Thus "the return on investment was lower and slower in the underdeveloped east than in established industrial regions." (Stone)
Another major flaw in Soviet plans concerning shifting vulnerable industrial areas was that they simply did not anticipate just how far the Germans would penetrate into Soviet territory:
...1931 evacuation plans for industry in the Soviet Union’s
westernmost regions planned their relocation deeper inside the
country, but not to safety in the Urals or Siberia. Two of Minsk’s
most important factories—Kommunar and the Voroshilov Works—were to
have their machine stock, workers and production split among five
factories all located in the Western oblast’ of the Russian Republic.
Plants in the Western Ukraine were scattered among cities in Central
and Eastern Ukraine: Zapor, Khar’kov, Rogan’, Sorodino,
Dnepropetrovsk, Slavyansk, Chernigov, Poltava.
Source: Stone
It was anticipated that counterattacks would immediately follow any enemy incursions and that "that not ‘one inch’ of Soviet territory would be taken by an aggressor".
When the invasion did come, Philip Boobbyer in The Stalin Era observes that,
The transportation of industries to the east was a feat which the
party’s highly centralised structures were well suited for (Lieberman
1985: 71). It was nevertheless not a smooth operation, and was largely
improvised. Sometimes, evacuated goods were simply dumped to permit
empty trucks to return to the front.
John Erickson, in The Road to Stalingrad, says pretty much the same thing:
There had been only scant pre-war contingency planning, there were no
actual plans for any strategic industrial withdrawl into the eastern
hinterlands
The first evidence of detailed planning which clearly anticipated actual use of that plan seems to be the 24th of June 1941 when (referring to major industrial plants in western areas)
the GKO created a Council for Evacuation to relocate these plants
eastward to the Urals and Siberia. The task of coordinating this
massive undertaking fell on N .A. Voznesensky, head of the Soviet
industrial planning agency GOSPLAN....on 4 July he won approval for the first war economic plan. The Council's deputy chairman, the future premier A.N. Kosygin, controlled the actual evacuation.
Source: David M. Glantz, Barbarossa. See also Document 8.5 Formation of State Defence Committee (GKO) in Boobbyer's in The Stalin Era.
Despite this massive effort, there were huge losses in industrial capacity as the German advance was so rapid, even though
in the second half of 1941 a monthly average of 165,000 railway
truckloads of industrial equipment rolled eastwards.
Source: Boobbyer
As further evidence of the lack of advanced planning, Glantz says:
All this machinery arrived in remote locations on a confused,
staggered schedule with only a portion of the skilled workforce...Somehow the machinery was unloaded and reassembled inside hastily constructed, unheated wooden buildings.
Nonetheless,
Even allowing for the hyperbole so common to Soviet accounts, this
massive relocation and reorganization of heavy industry was an
incredible accomplishment of endurance and organization.
Note: highlighting is mine
Soviet reports from before the Five Year Plan found that much of the military production capacities in the Soviet Union lay in the country's war threatened Western provinces and notably the city of Leningrad.[55] In 1931 evacuation plans for military production facilities into deeper Soviet territories were drafted[55] beginning a policy that would accelerate and relocate deeper within the Soviet Union during World War II.– DrZ214 Aug 31 '22 at 19:17Stone, David R. (November 2005). "The First Five-Year Plan and the Geography of Soviet Defence Industry". Europe-Asia Studies. 57 (7): 1047–1063. doi:10.1080/09668130500302756. S2CID 153925109 – via Taylor & Francis, Ltd.It's a book, can't find it on Google Books and right now i can only afford "poor man's history" (wikipedia). Maybe someone can check it out. – DrZ214 Aug 31 '22 at 19:19