Stupidity: When the Keymaker is closing the door to the room that leads to the Source, he stands in the doorway resulting in the multiple Agent Smiths gunning him down. He could have easily closed the door without standing in the doorway and consequently would have lived.
Suggested correction: Who says the door was bullet proof and the Keymaker couldn't have been shot through the door?
The point of the stupidity is that he shouldn't have been in the doorway at all, even if the door wasn't bulletproof, there was no need for him to even stand behind the closed door. He could have pushed the door closed from the side.
It seems to be a heavy door, he simply couldn't close it with just his arm, thus he had to move his body forwards in order to close it. In that brief moment he got shot before the door closed. He could have for example kicked the door shut but he simply didn't think of that at that moment, also not knowing the Smiths were about to fire a volley of bullets at them.
Stupidity: The prison where Magneto is held should have had a contingency plan just in case of escape, like machine guns outside the cell, or tranquilizer darts, or gas.
Suggested correction: What good would machine guns and tranquilizer darts be against a man who can literally control and manipulate metal? As for gas, the area outside the cell is so large that any gas would quickly dissipate before it could be effective.