I remember reading someone doing the math on these and finding that statistics-wise, it was essentially impossible for these metabolic pathways to have evolved through randomness given the age of our planet.
Just an important detail. It's not just randomness. It's randomness + natural selection.
Keep in mind that as soon as an element is added to the system - and it works - that element becomes sticky. Rinse and repeat, and you get more and more complex systems over time.