Risk assessment. He made a snap decision based on the risk to himself (with possibly not enough information to make a fully informed decision) versus the benefits of having "less crime". His value judgement was also based on some pretty primordial instinctive reactions to protecting those who can procreate the species. Would he have done it if it were two men instead of two women? Simple answer, no he wouldn't.
So, yes, it does come down to thinking with his genitals, just on a level he probably didn't realise.
Oh, and one more thing in the risk/reward. How good do you think he felt, walking away with the adrenaline rushing through his veins and feeling of chivalrous heroism in his heart. Subconsciously, we men live for moments like this in our imagination, but don't often get the chance to see them through.