its not being a musician that helps you with computer science. rather its the musical training that trains a person's analytical thinking that assists a person in programming. and in mathematics.
In the theoretical and academic side, yes.
But pragmatically it's not that true, or at least, you'll find programmers that are using lots of maths, but they are generally using it at the application level [like a 3D game or mpeg encoding for example] where the maths is part of the application rather than the fact that computers are turing machines as such.
Many applications don't have more maths than things like adding vat at 17.5% This is maths to people who think that "1 and a 2 and a 3" means music and maths are linked.
Writing software and playing classical repertoire from a pragmatic pov seem very different IME.
I'd say one big difference is that writing software is about trial and error - the errors are key, whereas everything I read about playing classical piano suggests it's about trials without error - the errors are things to avoid.
Even avoiding the errors, lore suggests that is best done by mentor rather than by finding them and then avoiding them.
In some sense looking at existing code is sort of a mentor - but that's frowned upon in classical piano playing "Don't watch the DVD, there be smoke and mirrors and invisible movements - it only looks like their fingers are moving in fact it's the piano that moves, they lift it up with that pedal, if you know what to look for you'll see them pressing it - I played that note with my toe"

in a similar sense, good finished code or a formal mathematical proof doesn't show you the process, the struggling, the lack of rigour by which the programmer / mathematician came up with it. Understanding the proof, a common academic exercise, isn't going to help you come up with proofs and be successful in a pragmatic way.
Don't read that too literally though, I'm not saying one has this, the other doesn't and vice-versa - it's just the degree to which each does varies significantly imo.
If you learn some thing by being told what is correct and then repeating the correct thing. It's unlikely you'll learn about operating systems by writing one. You'd want to know what a correct operating system was first. "Here's fur elise version 2" "Ok, here's fur elise version 2" "Well done, how about a new operating system?" "Do you have the code?" "Err..."

I'd put classical piano playing closer to surgery / medicine, in the pragmatic sense.
Even if there are great scientific and medical theoretical bods who are coming up with new practises and procedures, surgeons are going to be focussed on repeating things correctly, with a tenacity for procedure, and through that repitition and focus to be confident that they'll "hit the right notes for the piece even when under extreme pressure"
Quite often the skills required to be successfully doing something are different from those required to work out what the skills for success are.
That's not to say people don't have both, but it's not immediately obvious that someone has skills if there use isn't a huge part of what makes them successful at doing something else.