Korea has players in almost every industry, but they are not competitive because they decided to focus their efforts into a smaller set of key industries. The four you listed are prominently known, but Korea was/is actually also competitive in appliances, chemical engineering, machine tools, automation (e.g. robotics), weapons manufacturing, and more. Obviously you can make the point that all of these industries are industries China is also interested in, but the question is not one of interest - it's one of opportunity cost.
In the simplest example, let's say Country A has 100 people and 10 industries to invest them in; it could start off by putting 10 people in each industry. If Country B, their competition, only has 15 people, their best play is to invest all 15 people in 1 of the 10 industries - ie "specialization" - so that they can beat Country A's investment. Country A can of course reinforce that industry with more people to match or beat Country B's investment, but then it'd be taking those people away from other industries, making those industries weaker. Country B can then pivot to those industries instead, in a never ending cat and mouse game, until eventually both countries reach an equilibrium and just agree that 1 of the 10 industries will belong to Country B.
That is the game Korea could have played, based on the principle of comparative advantage. Even if it cannot keep hold of the four industries you mentioned, it could have redirected and focused its resources to some other industry like chemical engineering or robotics, and dominated that, instead. Sure, China has a lot more resources (in talent, money, etc.) than Korea, but distributed across many different industries, it can only devote so much to any one thing. That's what leads to specialization and the creation of global supply chains; because at the end of the day, if we ignore geopolitics, resources are just resources - there's no reason why Chinese companies would not find a use for Korea's resources in their supply chain.
The issue is that China could invest in every industry and still have STEM personnel and investment money to spare.
So China has an absolute advantage in every industry, not just a comparative advantage.
If you look at annual STEM graduates which are useful, it does look like China has more than the rest of the world combined. Looking at China and Korea specifically, it looks like a 44x difference.