As someone who did exactly this as a child, I can tell you this has to do with the reward system in your mind.
This feels like a specific brain function, as I see it and analyse it, because it's one of those hard to decipher impulses that don't make much emotional sense at the moment when it happens. Because while emotions become easier to express and understand as we grow older, and emotions are eternal, this specific behaviour feels very specific.
To me this is a symbol that I have finally received good, and it really strokes that reward part of the brain that says 'finally, I'm receiving something worth having". Food especially is rewarding because it's a primal need that feels emotionally comforting because of it, and sugar itself is incredibly enticing (and let's face chocolate today isn't really chocolate it's a whole lot of sugar).
So I see no reason why I should ever part with that. And it goes beyond chocolate, because for instance, I love pierogi, I really just love it. You're not gonna see me share my pierogi when I'm having a plate of them any time soon, haha. It's because it's like parting with something nice and sweet and rewarding, and it feels like deprivation of that: why should I ever deprive myself of that? I have no reasons to.