Indeed, electrolytic smelting is around and is currently used to produce high purity iron.
There are a few engineering difficulties arising from the high temperatures required and the chemicals around.
And note that aluminum smelting also releases quite a lot of carbon dioxide for various reasons, one of them being consumption of the graphite electrodes.