I guess they will just unplug it? the fact that they need large amounts of electricity, which is not trivial to make, makes them very vulnerable. power is usually the first thing to go in a war. not to mention there is no machine that self replicates. full humanoid robots are going to have an immense support burden the same way that cars do with complex supply chains. I guess this is the reason nature didn't evolve robots