What the Lord was saying is "Do not detain me now", since He was to first ascend to the heavenly Sanctuary -- the Holy Place -- as our Great High Priest and "by His own blood He entered in once into the Holy Place, having obtained eternal redemption for us" (Heb 9:12). We are not told at what point He ascended with the souls and spirits of the OT saints, but that could also have happened then (Eph 4:8-10).
Also, Mary needed to learn that she could not (just as Paul could not) "know Christ after the flesh" (in His original humanity) any longer. That she was to be a messenger for the Risen Lord at this point. We seem to forget that absolutely none of Christ's disciples actually anticipated His resurrection, Mary included. They were prepared to embalm Him and leave Him in His tomb.