Before baptism, the soul is void of sanctifying grace and is unable to receive it, because it is baptism that makes the soul receptive to that grace.
Here is an analogy: If you try to capture water on a round surface, like a ball, the water will roll off. But if you put a dent into the top of the ball, it can hold water. Our soul before baptism is like the ball, and grace is like the water. The soul cannot capture the grace, just as the ball cannot capture the water. After baptism, the soul is like the ball with a dent on top. It can capture the grace it receives. Continuing the analogy, if the soul turns away from God, it is like the ball turning itself upside down, away from God. The water (grace) is lost and the dent cannot capture any more until it is turned upright, toward God again. Confession is the normal way we turn the soul back toward God.
Baptism permanently changes one’s soul to make it capable of receiving grace. Each sacrament imparts sanctifying grace to the properly disposed soul. If mortal sin occurs, the grace is lost. The soul can receive it again once reconciled to God, because the special character that baptism bestowed remained even when the grace was lost.