I don't think you can recreate this in any top-down manner no matter how well-intentioned.
It has to matter to them, and what's more, it gives you extra boost if you aren't supposed to do it and no parent or teacher pats you on the shoulder, but rather your friends or people in online forums like it, or simply you like it for yourself, seeing that the computer does what you want.
I learned computers by making a website for my school class, where we would put pictures from events and excursions, hosted a chat and a phpbb, designed the graphical elements in cracked warez Photoshop etc. This forced me to naturally pick up the skills. HTML, JS, burning ISO to CD, downloading things etc. Also warez games, learning about the Program Files difectory at like age 8 and how to copy the cracked exe there. Or setting up port forwarding for multi-player gaming.
Or when I modded GTA (3/VC/SA) with new car models that I built in 3D modeling software based on hunting down the orthographic projection blueprints of our family car, or adding the police vehicles from my country in GTA, messing with textures etc.
Or translating games from English, reverse engineering the binary file that contained the strings, I figures out that the length of each string was also there and I had to modify that too, learn about big endian and little endian, learn to work with a hex editor, understand what hex is. It was super exciting. If I had a lecture from some teacher about hex representation with some exercises at the end of the chapter for homework, I likely would have found it boring. But here I had context, I had a goal, and I had no idea what I was looking at when I opened the hex editor, I just saw that people used similar tools for translating other games and so I tried on less popular games where nobody had a specialized tool yet, it felt like making discoveries, going deep into the jungle and prevailing.
Now to contradict myself, I did have a lot of fun also while solving PythonChallenge.com, even though it's artificial tasks. But at least I found it myself online and wasn't handed to me and nobody knew or cared that I was working on it.
So I think this is just really hard to externally motivate if the kids don't have any desires or drive to see some effect caused by them. And maybe even I wouldn't do it in the current software and phone environment.
But we also have to remember that a generation ago it was also not many people who were really into computers.
I have found this while trying to teach my kids how to write anything software related from scratch. They've done some code.org, but it becomes boring quickly. We tried to make tic-tac-toe in js/html/css since they can do they whole thing in the browser. It held their attention slightly longer, but still became boring. It's not something they want to do.
I totally agree with you on learning for a purpose, picking up knowledge is super easy imo when you're in pursuit of a goal bigger than picking up knowledge. You don't even realize all of the things you learn in order to achieve your goal. But you have to want a goal.
I also totally agree sometimes it's fun to just do dumb problems, I found these CAD modeling youtube videos where guys will race each other modeling some part off of a print, spent a week just screwing around with those because it's fun to flex sometimes.
On the other hand if I'm honest, all this noodling around as a teen didn't give me a super robust foundation at all. I had a kind of folk understanding, or rough mental model of the things but it made me like it as a hobby and identify with it, which pushed me to take up CS in college.
It gave me some head start that I knew Python and JS when learning C, but not super much. Other students, who were smart but didn't fiddle with computers as much, generally picked these things up along the way, 4-5 years college is plenty time to develop the skills if you got the talent.
Also my understanding of networks was super shallow based on just multi player gaming and learning router settings, and I only really built a proper mental model in college with OSI model, TCP/IP details, reading the Tanenbaum book, doing socket programming etc.
So these generic tech and computer skills are in my opinion more about giving people a sense of agency, which is still quite something. That you put together your own PC, that you download your own subtitle files for the movies and figure out how to adjust the sync to match your version of the movie etc. It just gives you a feeling that you can do things. If something is wrong, you can, and therefore want to fix it. It's a different attitude compared to just accepting everything as it is.
[dead]