Why is it profitable to build a rare earth's refinery anywhere ... let alone in Malaysia. Bottom line is that the world has fallen in love with clever communication devices and the like that are made using rare earths. Without the use of rare earths these devices cannot be made.
As I see it, the problem is that the main driver of investment and corporate economic activity is money profit, which was well and good in the days of Adam Smith and sailing ships, but has dangerous consequences in the modern world where amazing technology can serve us well, but the same technology carries risks that can do huge damage.
At the moment with the simple money profit market driven allocation of resources, corporate decisions are made based only on where the most money profit can be made. This is often in places where the requirement for safety and risk management is the lowest, and where business interests are able to subvert reasonable required regulation.
The sad fact is that billions ... yes billions ... of cell phone users and other modern devices have no idea of the supply chain that exists of bring them these things. The corporate business world is quite happy for people to be ignorant and for abuse of all sorts to go on. This will only change when there is ubiquitous sharing of such information by an informed public to itself so that in the end the consumer will start to force companies into good practice or else there will be no customer.