I think this is a consequentialist look at morality, whereas I believe the Bible teaches quite differently. Consider what Jesus says here,
"Many rich people put in large sums. And a poor widow came and put in two small copper coins, which make a penny. And he called his disciples to him and said to them, “Truly, I say to you, this poor widow has put in more than all those who are contributing to the offering box. For they all contributed out of their abundance, but she out of her poverty has put in everything she had, all she had to live on." - Mark 12:41-44
It's not about the results of ones actions. The women here is not judged by the quantity which she gives, but by the strength it took to give. As a side note, married people may not be able to serve the Church as much, but by raising a Godly family they serve God in an equally important way.
Indeed, masturbation is no different from any old sin that a married person commits, but if a married man said, "I have given my entire life to Christ, but occasionally I lie to my wife because I like to get drunk at pubs with friends from work" I would say the same thing of him; he has not given his entire life to Christ.