Holy Quran 7:172 When your Lord took from the children of Adam from their backs, their progeny; and He made them witness over themselves: "Am I not your Lord?" They said, "Yes, we bear witness." Thus you cannot say on the day of Resurrection that you were unaware of this
Here, the promise we made in the mother's womb before birth is being mentioned. So, when this promise was made, we were already created and had physically begun to live in a material sense. In short, this is not referring to spirits/ghosts, but to living physical organisms, to the body.