That is a myth.
These defenses you talk about were built partly with cheap material and therefore significantly less effective. This caused a major post-war corruption scandal.
Nazi Germany did not invade Switzerland, because Switzerland was actually more useful as a neutral state for Nazi Germany to exchange gold for commodities, for spying and Switzerland produced militiary equipment for Nazi Germany anyway.
The Nazis did plan an invasion. See Operation Tannenbaum[0].
Switzerland didn't end up getting divided between Germany and Italy thanks to the Red Army hurtling more humans west than the Wehrmacht could supply bullets east. Swiss munitions production wouldn't be risked.
Nazi Germany did not invade Switzerland, because Switzerland was actually more useful as a neutral state for Nazi Germany to exchange gold for commodities, for spying and Switzerland produced militiary equipment for Nazi Germany anyway.