I am going to go out on a limb with this one. What usually accompanies masturbation? Fantasy. Often chained thoughts or images that build up until orgasm is realized. I propose that this fantization is "play",practice or in a form planning for the real thing. Often these sex scenes are projections of what we would like to happen. Mentally playing through of these scenarios prepares us to realize the acts that will lead to sex. Ex. Imagining a potential sex partner and fantasizing how we would come to have sex with this partner reinforced by orgasm. So in the old cave man scenario we would have been imaging how we would club the partner and run off with them.
So maybe masturbation has actually helped to develop our brains ability to project into the future.