It's interesting you mention playing the piano as an example, because that's a very good example of how the opposite of what you're saying is true. Try to learn a piano piece simply by playing it many times, and it'll never happen. However, try to commit the notes intentionally to memory, and reading the notes becomes unnecessary very quickly. Same with trying to memorize text; if you read without explicitly trying to memorize it, you can read it infinite times and never manage to recite it back.
I think your example about list.size doesn't contradict this. It's the difference between "familiarity recognition" memory vs "consolidation and retrieval".
You do not bother committing "size()" because it's unnecessary (or because there's a lot of interference from other languages which do the same thing, hence the cost of committing that fact for later retrieval is not worth doing so).
But you have committed the "concept" to memory, and this can be retrieved even without the need for the label.
"Understanding" is only part of the equation. But I do generally feel that "having the basic building blocks readily available helps you build complex understanding on top of them, which then helps you consolidate the complex stuff better" is probably the main direction, rather than "understanding a complex concept helps you better remember the basic building blocks that made it up in the first place".
This is also why anki works so well for learning theoretical subjects (even if it has traditionally been more popular for pure memorization tasks, like language learning)