I was a bit older than 12 when I learned programming with AutoIt, Ren'Py and Blender, but I would absolutely have enjoyed it if I had found out earlier. I didn't learn those because some adult told me to, I found out about them through my friends.
AutoIt is a programming language geared towards automating interaction with GUIs. A friend of mine was using a program written in it to bot in some MMORPG, and being able to control the mouse pointer also lent itself to prank programs we'd send each other. I learned quite a bit just by modifying that original program, and later implemented Gaussian elimination in AutoIt to take care of my math homework.
I learned Ren'Py when another friend showed me a simple visual novel he'd written in it, and I got inspired to write my own. For some aspect of it (I think it was to keep track of health points?) I needed to use Ren'Py's Python scripting, and so I ended up learning a bit of Python.
Later, I was doing a stop-and-go movie with Lego figures together with that same friend. We really wanted to have awesome 3D effects and had heard that it was called animation or something. So I googled it, downloaded Blender, and went through the tutorial on modeling. I mean, how hard could it be, right? I think Blender is somewhat renowned for the complexity of its interface, but at that time every interface was complex for me. After weeks of painstakingly remodeling Lego pieces down to the little notches, we finally had our space battle with lasers, and it was awesome. Later, I repurposed those models for a game using Blender's built-in game engine, and it was easy in comparison (although I still don't fully understand how rotation in 3D space works).
In all of these cases, programming was something I lucked into as part of some other activity. I wanted to do something else, and writing code happened to be easily available as a solution. So I think what a parent can do is give their children the opportunity to play around with lots of different things, and when something they want to do requires a little code, show them how to do it.