It's not fun. The activity is not an enjoyable act of entertainment. It's stressful, time consuming and miserable.
The result is what matters. You did something. Learned something. For you, not because it was in some work planning. It provides catharsis.
That sort of catharsis does not exist in some work related environment. It never will, unless stars align magically, which they almost never do.
I am highly skeptic of this "code is fun" perspective. Always was.
That's why "all your base belong to us" kind of contracts in which stuff made outside work COULD become property of the hiring company makes otherwise happy developers into depressive under-productive nightmares. Let them code the toy thing unharmed in their spare time, for fucks sake.
Let it be the real thing. Stop this nonsense fairytale.
It is for your own good. It prevents companies from hiring con men, it prevents young folk from being drawn to a career they will despise, it prevents massive loss of investment.
I wanted to code for catharsis. To learn. To feel I made something. Wanted, past tense. These "code for fun" people were serious contributors to my burnout.