The gemara says that since a rodeif doesn't require warning, even a rodeif who is a child can be killed. Based on this, a 3 year old child holding a loaded gun aimed at someone with his finger on the trigger, can be killed even though the child isn't aware of what he is doing. The question is whether this idea applies only to a rodeif who is trying to kill, due to the significance of pikuach nefesh, or would it even appy to a'rayos? Meaning, if a child or sho'teh would be trying to rape a woman, would a bystander be able to kill the rodeif to prevent violating the victim?
The Ohr Samei'ach (Rotzeiach 1:13) writes this would be dependent on what the heter is to kill a rodeif after a woman to rape her. According to R. Yehuda 83b who considers a rape victim to be life threatening since she will try to save herself and may lead to him killing her, a bystander can certainly kill the rodeif as he would be able to kill a rodeif who is trying to kill. But, according to the Rabbonon that the Torah heter to kill a rodeif after ara'yos is that the Torah cares about the degradation caused to her, this would only apply to an adult who is a rodeif, not a child (or sho'teh). The Ohr Sameiach does acknowledge that the Rambam in sefer hamitzvos (lo ta'aseh 293) explicitly writes that one may kill a child who is rodeif after ara'yos to rape her. Clearly, the Rambam understands the degradation associated with rape that entitles the bystander to take the life of the rodeif (rapist), would apply even if the rodeif is a child and that is why a bystander may kill him to protect the victim.