Sage Yajnavalkya: “…the Jiva (=soul) who resides in one gross body does NOT leave off that body BEFORE getting hold of another one. If another body is not obtained, it will not leave the present one,. A king or a land-lord or any other person for that matter, does not leave his dilapidated house BEFORE constructing a new one. Similarly, before getting ready the new body, the Atma (=soul) does NOT leave the old one…
“As soon as the palace officials come to know the king’s desire for a new palace, they at once, even while the king is residing in the old palace, construct a new one and furnish it with all requirements like horses, elephants, etc….
“Several karmas of a person who is in the jaws of death, create well in advance the body to be assumed by him after death.”
Source: pgs. 200-201, The Philosophy of Sage Yajnavailkya [The Divine Life Society publication]
Note: Yajnavalkya was a legendary sage of Vedic India, who authored the Shatapatha Brahmana (including the Brihadaranyaka Upanishad), the Yoga Yajnavalkya and the Yajnavalkya Smṛti.