The most important part of this chapter and to their friendship is the lie. Hermione’s lie to take the blame for finding herself in the bathroom with the troll through no fault of her own. I know the feeling of absolute loneliness seconds before certain death can translate into greater questioning of everyday life but, she still went against her values. She was vulnerable in front of Harry and Ron, showing them she will have their back in the hardest of circumstances and would make a great friend.
This translates(or tangents) to the bigger idea of new friendships. Bear with me here, If you compare one’s personality to an onion, the layers represent the spectrum of their values, some on the outside visible in everyday life but, some very well hidden. The layers keep building as we grow and solidify our values. It then gets harder and harder to get to the center i.e. to completely understand someone. The level of trust you have with that someone correlates with the knowledge of the layers and the transparency. It’s not that there’s something bad hidden deep but that you don’t know what’s inside, the same applies to your own personality too. That may be why, at least for me, making friends got harder as I grew older. It’s easier to form friendships when you are younger when your values are ill-formed than when you are older and have a formed identity.