- electricity (from solar, hydro, nuclear, whatever). maintained by robots.
- it is repaired by robots using resources mined or reclaimed by robots.
- you guessed it, robots.
- robots with weapons.
If we actually want to prevent this doomsday scenario, I don't think it's wise to bet on "robots will never be able to do X".