Thus, in Mary Magdalene’s case, Jesus was dealing with a misplaced desire to prevent him from leaving; in Thomas’ case, Jesus was helping someone who had doubts.
Those texts are simply making the point that confidence in God is never misplaced, but putting confidence in imperfect humans can at times lead to disaster.