First of all, animals do it simply because sex drive has insane positive evolutionary selection pressure. Humans and their ancestors obviously had sex for millions of years before they even understood that sex is for reproduction. So I think you should rephrase the question a bit to take that into account. The "intellectual" or voluntary control of sex is a recent add-on.
The fool hath said in his heart, There is a God. They are corrupt, they have done abominable works, there is none that doeth good.
Psalm 14, KJV revised edition


