Loneliness is not about being alone but, to not feel loved, by others or by themselves. They have to find solace in their thoughts to keep the feeling away. The lack of love felt by Harry while having to watch his “equal” showered with loads must be depressingly lonely. I hope he found solace in his cupboard, a bubble in his existence where he could keep the lonely at bay.
I find parallels between the lives of Harry Potter and the boa constrictor, both lived their whole lives in captivity, both longing to get out and as the boa constrictor does through the magical intervention of Harry, Harry too through the intervention of the magic finds his freedom. His own world to grow and find out his strengths and weaknesses.
P.S. The snake’s eye roll at the Dudleys was a moment of wry humor in a story about the sorry state of Harry’s life.