In Devarim 25:11:
peshat is that this is an application of din rodef. If you see someone trying to kill another, you may kill the murderer to prevent him from murdering the victim. If killing the attempted murderer is what must be done to prevent the act, you do that. If you can prevent the murder with a lesser injury (such as loss of a limb), you must do that instead.
The assumption is that in the instance described in the Biblical verses, the woman is still grabbed on to him. If she crushes the man's testicles, the man may well die from such a serious injury. Thus, you should cut off her hand if she is in the process of crushing. (And thus, it is not a punishment after the fact for permanent injury caused.) Your eye should not spare, because doing so is at the expense of the victim.
What called this to mind was the following story reported in the press. A woman attacked her husband by crushing his testicles, and he was in critical condition but is now in stable condition. The woman could have faced attempted murder, according to police.
From 6abc and Action News:
A Philadelphia woman is in police custody, accused of an attack against her own husband. Police say she grabbed him in a jealous rage so hard that he lies hospitalized and she is facing charges.
Police say the wife believed her husband, Howard Randall, was cheating on her. So, while he slept, police say the woman grabbed and squeezed a part of his male anatomy.
Randall was rushed to Einstein Hospital with severe bleeding. Doctors first labeled his condition critical but he is now listed in stable condition at the hospital.
His wife now faces aggravated assault and other related charges. At one point, authorities said she could have faced attempted murder.