Firstly, playing with others is great fun, and a great way to learn and improve. Not to mention a good motivator. Like you, most of my improvement has been in that context.
When I was just starting out we had "bands" of beginners (guitar, piano, bass etc) and there was a sense of progress learning just one chord or riff etc.
So -how- you learn matters. Equally "starting young" is a common wisdom, but most of the people I play with now "started old". They started because -they- wanted to play, not because someone else wanted to play.
I think method also matters. In school we "learnt" recorder, but it started with "reading music". That's like explaining virtual methods in object orientated design to someone who can't write a for loop.
For both activities we learn better when it's fun.
Firstly, you can be productive -very- quickly on other instruments too. Guitar and piano are both "good enough" even if you can only play 3 chords. You can then learn more as you go.
Secondly, being productive in coding from very early should be qualified with "for some definition of productive". Yes, you can write code, yes it meets the spec, but usually there's also an element of feedback in code review. Sometimes a lot of feedback.
I concur with the grand parent, we get -better- at coding with practice and experience. As long as you are getting feedback in some way.
The "practice" part might be in challenging your own solution. Rewrite it to go twice as fast. Or in half the code. Or not using that convenient language-provided data structure, or whatever.
For the record I'd describe myself as an "excellent" coder (in my field) but my drumming as "enthusiastic". Competent amateur maybe, but far from "professional".