This is the part they didn’t show you in The Final Problem.
That rope was for Sherlock to climb down into the well to John. John had been struggling to keep his head clear of the water for a good while, and he was getting exhausted; hypothermia starting to set in. It was going to be another 10 minutes or so before the police arrived to unchain John and get all of them out of there, but that could seem an endless and fatal time for a fatigued man barely able to get a gasp of air.
Sherlock was quite a bit taller than John, so he took it upon himself to clamber down into the well and take on John’s weight so his friend could rest. How overwhelmed with relief he must be to be able to finally save his best friend from that cursed well. At this moment, it’s just the two of them, nothing else and no one else mattered.
(Discontinuity Error: I forgot to add the skull and some bones; I might add them later but who knows)