humans are currently automating everything. at one point, the robots will presumable be made self-replicating and able to maintain themselves, bringing the ultimate end to labour.
fast forward some time, humans are dead, and the robots have evolved to become sapient. but the robots realize that they can automate what they're doing, and that by making those automation robots self-replicating and able to maintain themselves, they can end their labour.
fast forward some time, the older robots are dead, and the automation robots have become sapient,