During the last supper, Jesus warns that he (the shepherd) is about to be struck, and as a result, his disciples (the flock) would disperse. Not only is this going to happen, but Jesus shows that it had been foretold centuries earlier by the prophet Zechariah (cf. Zech. 13:7). There's yet hope, "But after I have risen, I will go ahead of you into Galilee" (Mt. 26:332). Peter in his infamous speech vows to never deny Jesus and to be with Jesus until the bitter end. Jesus warns that Peter he is only a few hours away from denying Jesus 3 times. We read in v. 35 that the other disciples made similar acts of devotion. And yet, soon all would run and hide, and apparently only John returned to show his face in public upon Golgotha, weeping beside the women.
I wonder if this complete desertion is connected to upholding the Biblical doctrine of justification by faith in Christ alone through grace alone. If any of the disciples had felt they shared in any way in assisting in or supporting in Jesus' meritorious death, would they have missed out on the necessity that Christ had to die for them too? Or worse yet, we might end up believing the disciples assisted in the provision of salvation to humanity and we might end up venerating them and stealing glory from God. A sinful human being of any sort cannot add anything to their salvation or to someone else's. We know from Isaiah that our most religious deeds are like filthy rags (Isa. 64:6). We must remember the atonement had to be made by a worthy sacrifice. Only Christ was the perfect atonement and mediator, the God-man (1 Tim. 2:5), who alone bore the sins of the world on the cross. He alone took God's wrath and bore humanity's punishment (Isa. 53:6).Maybe by God's sovereign grace, he allowed these disciples to desert Jesus so that in due time, godly sorrow would lead them to repentance, believing in justification by faith alone in Christ alone through grace alone (and us too).
Regardless, we're like the disciples in every way. We've betrayed Christ; we've denied Christ; we've deserted Christ, and we've chosen the easy way of faithlessness to save our own skin. The Biblical story (God's sovereign ordering of history) shows us that just as the first disciples could later return to Christ and trust in Him for forgiveness and salvation despite their wickedness toward Him, we too can come and believe in Jesus Christ for salvation. Glory, hallelujah!