What’s the name and purpose for inclusion of secret elements?

I really don't know how to better enunciate this question. The best way is to go to your profile and see the "hats". This is something StackExchange does at the end of the year. And it's basically some kind of gamification process with no real purpose other than being "festive".

See example below:

enter image description here

However, my question goes around this part of the pattern: what is the purpose of having "secret hats"? It clearly violates rules of UX (specifically Locus of Control) and adds no purpose. Furthermore, it let the user wonder what did she do in order to get that hat. Did she do something good or something wrong? Is this and expression of StackExchange measuring behaviors? And if so, what's the purpose and would this affect users? There's even a leaderboard for this, which suggest this is related to engagement

Independent of StackExchange, what could be a possible use or advantage for this pattern?. There's even a leaderboard for this, but

Also, what's the name of this (anti) pattern? At first I though of Easter Egg, but the concept of Easter Egg goes around DISCOVERING it, not HIDING it. It's hidden, just not completely secret.