Some of my worst childhood memories involved me going from really happy to unexpectedly in trouble... and I'll tell these stories knowing full well that they're first world problem sorts of things, when you have a happy childhood the "worst" memories are petty and benign, I totally acknowledge this about myself.
I was 8 or 10 in dance class, and I had new tap shoes, and when the instructor told us to all change from our ballet to tap shoes everyone did the usual dwadling and running around. Except me! I was good, I got my shoes on before anyone, and got out of the way, sitting gingerly on the floor by a wall with my heels on the ground, tapping my toes against the wall. Then I hear my instructor screaming, and realized it was at me... the good one, the fast one, what happened! My toes were leaving little tap shoe scuff marks on the wall, and she'd "just painted that wall, now look at it!". I felt awful.
When I was 12 I was sick and had to miss school. The next day Mom said, "When you weren't at the bus stop, the driver waited for you until I waved her on, that was very nice and you should thank her." I got on the bus and said, "Thanks for waiting for me yesterday!" as I hurried back to my seat, but I didn't make it to my seat before the bus driver floored the accelerator, sending me and my books flying. Kids were laughing, and I was shocked, just thinking it was an accident. At the next stop she turned around and looked at me and said, "I DID wait for you yesterday, you have a lot of nerve to come in here with your smart mouth, you think I can just wait forever for every kid? Well don't count on it next time!" I couldn't explain myself, she just kept ranting.
Kids do stuff that they know is wrong, and then they deserve that anger and disappointment to drive the point home I think. But when you think everything's good, the unexpected feeling of being in awful trouble just makes you feel like you can't figure the world out. Maybe it's because you feel stupid, in addition to being in trouble. Maybe it's disappointment that the world isn't sharing in your joy.