Jaime, You are absolutely correct. If Mary had touched the Lord, she still being unclean, would have defiled the Lord. The answer to your question lies in the words Jesus spoke to Mary,
John 20:17, "Touch me not;"
"For I (Jesus) have not yet ascended to my Father."
To ascend is to go from a lower place (earth) to a higher place (heaven.)
His next contact with men was on the road to Emmaus. Jesus spoke with them, then sat with them for a meal.
Between his speaking with Mary at the tomb, and the road to Emmaus, the Lord had ascended to the throne of his Father as our High Priest, clean of any defilement, and made the offering of blood to the Father for the forgiveness of man's sin.
1 Tim.2:5, "For there is one God, and one mediator between God and men, the man Christ Jesus." The type in the O.T. was the high Priest that went into the holy of holies. Christ is the anti-type that went into the Holy of Holies in heaven.
The Father was the offended party, and that offence has been healed by the finished work of Jesus Christ which the Father gave him to do.
2 Cor.5:18-19, "All things are of God (the Father,) who hath reconciled us to himself by Jesus Christ, and hath given to us the ministry of reconciliation. To wit, that God was in Christ, reconciling the world unto himself."
Rom.5:10, "For if when we were enemies, we were reconciled to God by the death of his Son, much more being reconciled, we shall be saved by his life."
In this Jesus fulfilled the duties of our High Priest, our Mediator, He is our bridge to peace with God the Father.