Avery
Those who believe in evolution speak of evolved "strategies," but they're just behaviors or characteristics that were "selected for" over time because they led to greater reproductive success. The term does not imply conscious planning or strategizing in the human sense.
Those who believe in special creation speak of God's design, and His decision in His wisdom to give certain animals certain characteristics and instincts.
I cannot imagine that male apes have any concept that there is a cause and effect relationship between self pleasure and the probability that the female they are mating with will have their biological offspring instead of another male ape's. From the perspective of the ape, it probably just feels good.