They can imagine their code doing a million crazy things, but they hardly think about the incredible amount of things that need to exist and operate at 100% before a single line of code can be run on a VPS.
How many of these guys have had to tell a customer something silly like ”we lost connectivity to the DC because a farmer decided to do some digging and cut fibre lines connecting the DC to the internet”? If they knew that this was in the realm of possibilities, they wouldn’t be so confident about a program being able to somehow run amok and simultaneously feed itself all the resources and components it needs to run, as you mentioned.
Any AI smart enough to be a existential risk is surely capable of manufacturing swarms of insect-sized drones equipped with lethal poison injectors. This is enough to wipe out 99% of humanity within a few days. The 1% who were able to defend themselves become easy targets in the ensuing collapse of civilization. But I don't think this will actually happen: I only have human intelligence, so my ideas are stupid compared to what a super-intelligent AI could come up with. A truly smart plan won't allow for any survivors.
Like any good dictator, it will turn half the population against the other half first and get them to genocide each other. Because there is one thing we hate more than killer robots, it's ourselves.
Then you setup your new kings under your control (as AI) and make them very paranoid against the population so you still have more humans killing humans rather than AI doing the job. Of course now that you're starting to run low on population you'll need more robots right?
Greedy people are easy to manipulate, and greedy people love getting in positions of power.
By the time lazer carrying robots are finishing up it will have been way way too late.