Question: If AI takes over the world how could it create and maintain the infrastructure that humans currently provide?
Answer: An unaligned AI would not eliminate humans until it had replacements for the manual labor they provide to maintain civilization (e.g. a more advanced version of [https://en.wikipedia.org/wiki/Tesla_Bot Tesla's Optimus]). Until that point, it might settle for technologically and socially manipulating humans.