In Tantras, we find the mention of Navakanyas or Kulanganas, who are generally nine women who come from different backgrounds and represent the total feminine spectrum of the society. This reflects the core essence of a particular verse from Devi Mahatmya, according to which all women are but parts of Parama Prakriti:
Oh Devī! The eighteen doctrines including Vedas arth thine parts. All women, endowed with thine sixty-four Kalās arth thine forms. Thou alone pervadest the universe from inside and outside as the birth-giver. The literal and esoteric description of the praiseworthy is called eulogy. When thou arth the form of all descriptions, then who arth competent of singing thy eulogy? (Devi Mahatmyah 11:6)
Unlike masculine sects like Vaishnavism, where authority is in the hands of puritanical clerics, Tantra is all inclusive and acknowledges the sensual, emotional and mercurial sides of human consciousness. Here, a woman can be Striguru, and if she is one among the Kulanganas, the Sadhaka under her tutelage is considered the most fortunate.
The following verse from Guptasadhana Tantra gives the list of Kulanganas:
Națī (dancer/actress), Kapālikā (skull-bearing Tantric), Veśyā (prostitute), Rajakī (washer woman), Nāpita (barber), Brahmāņī (Brahmin), Śudra, Gopāla (milkmaid) and Mālākāra (gardener); women of these kinds are known as Navakańyās. (Guptasadhana Tantra 1:12)
According to the Puja Paddhatis, the idol of Devi Durga must be made from the clay taken from the courtyard of these women, soil taken from seven holy rivers, soil taken from elephant's tusk, soil taken from wild boar's tusk, soil taken from tiger's claw, soil taken from cow's horns & hooves, and soil taken from 51 Shaktipithas. In those places where stone, metal, wood idols or Yantra are worshiped, the soil collected from these places is scattered under the altar on which Devi Ghot and Navapatrika are placed. Other than that, when Kumari Puja is performed on Maha Ashthami, the Kumari should be the daughter of either of these nine Kulanganas and should be between the age groups of 1-16. A Sadhaka can worship one to nine or sixteen Kumaris at a time.
Now according to the question, why soil from a prostitute's courtyard is taken. The answer to this question would also answer why a prostitute can become a Tantric Guru and why her pubescent daughter is worth of being worshiped as Kumari.
As we know, a prostitute is visited by many men. She has the autonomy to go with any man she desires. She doesn't see if the man visiting her is a Hindu or a Muslim, a teenager or an octogenarian, a saint or a criminal. She is indifferent to the masculine gaze of our male-dominated puritanical society, that shames away from everything sensual and out of anxiety rather blames woman to be the root cause of desire than admitting its own follies and weakness. All that matters to her are money and pleasure.
So a prostitute verily embodies Kali, the primordial form of Adyashakti, who is indifferent to the masculine gaze of puritanical clerics. She drinks wine mixed with blood, dwells in cremation grounds, sits on a throne made of corpses, roams naked, has disheveled hair and copulates with Bhairava in public. She is that Divine light that challenges the dualities that contaminate human consciousness, and enlightens Her worshipers with the fact that his perception of a rope as a snake due to the influence of darkness, is false. Similarly a prostitute enlightens men with the fact that they are humans irrespective of their caste, creed and religion (read perceived identity) and hence is worth of worship and honour.
I hope the question has been duly answered.