Economist here. I'm not sure I agree with your conclusion, even though you're starting from a reasonable premise.
You're supposing a world where machines are able to do pretty much anything human laborers can, such that you could have an entire 'closed economy' without involving humans. And sure, from an engineering perspective, this is perfectly feasible. But there are two caveats I think your argument is missing.
First: who owns the underlying capital? Who are the shareholders of the "AI company", who owns the factories, the land, the resources being used? Some human, at some point, provided the initial working capital and is therefore the recipient of the enterprise dividends.
Second, and more importantly: what is the role for the other humans in this scenario? You seem to think that just because machines can do every task more efficiently than humans, that implies the demand for human labor will go to zero (please correct me if I'm misinterpreting). But this is incorrect; and here's where Economics can come to the rescue in this thought experiment: you'd be confusing absolute advantage with comparative advantage. The relative price of human labor will adjust such that the opportunity cost of human tasks with respect to using machines on something else creates additional demand for human work.
I feel like this post is already going long. But happy to iterate.
Unfortunately, comparative advantage won't help enough. The price of human labor won't go to zero, but it'll fall in real terms, a lot. I had another post about it, "poverty in the midst of abundance" which is linked from this one. Actually it's very short and I can just quote most of it here:
AI will lower the price of goods you need to survive, and also the price of your labor. The question is which will get cheaper faster. Let's use energy cost as a proxy. A day's worth of labor equivalent to yours can be done by AI for just a few cents in electricity on... (read more)
A fallacy I keep seeing: "If AI automates all jobs, who will buy all the products?" "At some point they'll need to implement UBI so that consumer demand continues to exist", etc etc.
Demand in itself isn't valuable. If you have a bunch of food, you can feed it to lions: they'll happily provide demand! But they won't give you much in exchange, so there's no point. Economic activity isn't about getting rid of stuff, it's about getting stuff in return.
An AI company can consume resources, like energy for running the servers, same as a human can consume food. And the AI company can be contracted to do jobs, like a human, possibly for less resources per unit of work than a human. There's nothing that requires a human to "close the loop". An economy of AI companies producing and consuming goods can easily be imagined.
If it helps, you can "close the loop" by thinking of a specific kind of ultimate good: growth. An AI company owning a plot of land can consume resources, produce goods and sell them to other companies, in order to grow and own more territory. No humans need to be involved. This evokes a world of AI-powered "blobs" with increasingly superhuman technology, all pushing against each other, burning resources for growth by economic and military means. Maybe some of the blobs will have a tiny group of humans at the helm and others will be fully automated; competitive pressure will ensure that they behave the same. I think such a world is our most likely future.
What will be the fate of humans in such a world? Probably something like the native critters in the video game Factorio, scurrying around unimportantly next to the huge automated factories being built. If a critter says: "dear factory owner, please don't take the area's water supply, I'll bring you a bunch of twigs in exchange for water" - the factory owner will just say no. The water is used to make goods, which can be sold to other companies for more than a bunch of twigs. So the critters will have to move somewhere else.