I spent a lot of time thinking about this over the years and I have a few key thoughts:
The most important base-level skill seems to be the ability to hold the concept of what I call "signal flow" (and others would call "state") in your head. The two jobs I've done in my life that I've done for money AND for fun are programmer and recording studio engineer. They are essentially identical. Hear me out:
When someone sings into a microphone, the signal travels through a cable, into a pre-amplifer, then an equalizer that cuts out the low end, then a compressor to limit the dynamic range, maybe you add some reverb and some delay. You need to be able to understand what is happening to the signal at every stage. For example, if you run the signal into a compressor BEFORE you cut out the low end frequencies with an equalizer, the results will be dramatically different. If you add delay (an echo) to the signal and THEN add reverb, it will sound different and you probably won't get the natural sound you are looking for.
When I was training audio engineers, if they didn't QUICKLY grasp this concept, they were most likely going to struggle.
Software is pretty much the same. You need to know what each function is doing, the state of each variable as you step through, etc. If someone without any programming experience has trouble following the value of X:
X = 10
Y = 15
X = 5
X = Y+X
X = ?
Then they will struggle learning.
More recently, software has become a question of having a wide range of shallow knowledge, and the ability to google really well. But I think the fundamentals are the same.