I agree with the fact that Sherlock has suffered a traumatic event as a child - violent death of a relative? When he made a fuss about Carl Powers and no one would listen? Mycroft leaving the house for university...? - and associated it with Redbeard's death.
I'm certain he put up walls to protect himself from further trauma caring is not an advantage, but that they had started to crumble as early as SiB. Let me explain. In TGG, he almost lost John and it was revealed to him that John was his weakness 'I have been reliably informed that I don't have [a heart].'
'We both know that's not quite true'.
In SiB, he has confirmation of this when he wins the game against Irene. 'This is far more intimate. This is your heart and you should never let it rule your head.' He has realised that the heart that will be burnt out of him [ie. his weakness] is John. There's a crack in the wall - sorry, wrong fandom. I meant in the ointment. He distances himself again as he realised that. Keeps the phone as a memento of letting-your-heart-rule-your-head-will-ruin-you.
He lashes out as a defense mechanism in Hound when he fears it might become obvious even to you-see-but-do-not-observe-John and that sentiment will become once again a hindrance to the Work, put others at risk and make himself weak. He tries to put the walls he had erected back up, but that had not really worked, has it? Not for long, anyway.
Am I making sense here...?