Capitalism is already a planet-scale neural network optimizing a loss function: profit. The nodes in the network just happen to be humans.
Capitalism with AI would be exactly the same thing, but zero compassion (unless the AI has been trained for it).