South Korea does do it in some part for protection in my opinion. North Korea are a very unpleasant neighbour, allied with China, and SK depends on US support as a deterrent. The primary benefit is that it’s the heart of their economy, but I believe that defence is also a factor.
Being at a critical part of many crucial supply chains means that the US has a very strong interest in making sure SK keeps producing. Even if you look at advanced products mostly made in Taiwan - e.g. the nvidia H100s, the CoWoS packaging is done by SK Hynix.
South Korea is the second most advanced fab nation, and they are also very involved in some parts of the supply chain even for TSMC manufactured parts - e.g. SK Hynix does a lot of the CoWoS packaging.
Also, South Korea produces a lot of RAM, Solid State Drives, and many other things like display panels.