The basic idea of fusing sexual and religious imagery has appeared in many parts of the world. Folk religions often evoke new life and rejuvenation through magico-religious symbols and acts. In India, the earliest such surviving imagery dates from the Harappan times, such as the phallic statues of Dholavira. The Mauryan period has turned up many small terracotta plaques, likely used as votive offerings to popular fertility goddesses like Sri. These plaques have symbolic—non-erotic and non- amorous—depictions of male–female unions, believed to be auspicious for fertility and abundance (a similar idea inspires the likely even older iconography of yoni–lingams). But by the start of the Common Era, such plaques had evolved so that they started carrying realistic sensual images, including plainly carved amorous and copulating couples. It's likely that they still served the same votive purposes, perhaps in addition to being decorative objets d'art.
The earliest known fusion of sexual and religious imagery in stone in the subcontinent is on Buddhist monuments at Sanchi and Bharhut (second century BCE). Even though these earliest depictions were tame— non-erotic and non-amorous—it's safe to say that the inspiration for them did not come from the sex-negative Buddha. Rather, it arose from the syncretic milieu of the builders and their simultaneous embrace of many folk cults, including of yakshis and Sri, alongside the teachings of the Buddha.