If you're a small African village, having a couple of solar panels is way better than a coal power plant. You don't need roads and trains to continuously ship in coal or the lights go out. You can get more buildings electrified before you have a stable power grid because you have decentralized generation. You can have small/cheap storage batteries because you build infrastructure to begin with that demand shifts to during the day -- pressurize a water tank during sunlight hours so that you have running water through the night with no nighttime power consumption. Use high efficiency LED lighting to minimize how much battery you need. And so on. All of which is cheaper when you design for it from the start.
Whereas if you're at the stage of India or China with a real power grid where you have to start worrying about baseload, that's when you build nuclear. Assuming that declining storage costs don't eventually make even that unnecessary.
About the only thing fossil fuels are still good for is as an emergency battery for long periods of low generation from renewables. But then you're not building them as baseload power generation and they only get run one week out of the year. And even then it's still not coal, because you can do that with natural gas, which is currently cheaper (and cleaner and emits less carbon).
To get the first aluminum smelter the first world had to invent it. To get one now you just have to build it -- or have someone else build it for you. Then you power it with a ton of cheap solar panels and only run it during daylight hours.
So why would waste money building a bunch of coal fired power plants that you won't even need in a couple of years?
And why would it be uncompetitive on cost globally if everyone else stops burning coal too?
Sorry, but this is just ridiculous. If you need power all year long and only have say 250 sunny days and even less predictable winds, you are really looking at an order of magnitude higher price here than burning fossils. If you only use a little bit of that power able to directly satisfy a little bit of demand without storage, then it's not as expensive, but still overall significantly more expensive than burning fossils. The only reason it can even be deployed is if governments promise massive returns of investments and let investors get rich, which of course ends up hurting consumers with huge electricity prices. The rest of the non first world simply cannot afford that.
If it was economically viable, investors would just invest into solar and wind farms everywhere in the world on their own to undercut all those fossil competitors.