As with chip making, it can be done anywhere but the tools and factories setup to mass produce are concentrated in certain areas. That's just how industry works sometimes.
It takes time to setup new supply chains for mass production.
Mining (and refining) especially tends to come with some nasty environmental effects that we've been quite happy to outsource to other parts of the world with less empowered citizenry (and often cheaper labor).
Rare-earth elements are the same way - they're relatively abundant, but China is enormously over-represented in the market because the west doesn't like mining and China doesn't care.
Not just lithium. This program aired on the Aussie ABC last night on the terrible way Cobalt mining is being done in Congo and the total dystopia that has been allowed to occur. https://youtu.be/_V3bIzNX4co
Lithium mining is not that nasty. And Tesla for one wants to make it even less toxic. Besides there's just not that much life on the salt flat, yeah flamingos great, and the brine shrimp they eat, but come on. That's one of the meaningful defenses for mining in the Atacama, there's very little life to harm. Much better than mining in the middle of the Amazon, making four species endemic to the orefield extinct, don't you think?
Lithium is a great example. Canada used to be one of the major lithium producers in the 1950s and still has huge deposits, but output has fallen dramatically over the years and actually declined to zero in 2020.
It takes time to setup new supply chains for mass production.