I'm gonna be a little practical right now. Who is gonna build the drones, the surveillance cameras, and gas chambers needed to kill us all? There's not gonna be some day where general purpose AI is built and then everybody dies. Stuff will still need workers in order to build the tools to replace them.
This is the old historical process we all know and love. The one that kicked off this whole "capitalism" thing: mass automation replacing workers. It can get fast but it's never instantaneous.
And like, at every step of the way until self-sustaining AI (if that's even possible but let's assume it is), the laws of Capitalism will still apply: every factory that produces components for data centers will want some profit and -- assuming the slow replacement of workers -- will see their rate of profit going down the drain. That will kick off austerity, wage cuts etc. which will accelerate class struggle.
What I'm saying is that capital doesn't have a grand plan. It's a bunch of enterprises that have their own interests. Even if some rich assholes at the top have a plan, they can't personally plan the entire economy, they can't create killer robots out of thin air, they can't avoid squeezing the workers dry until AI becomes their omnipotent servant, and they can't make every single factory or enterprise stop thinking about profits for a little bit until they don't need labor anymore.