How many people do you know who studied the piano at one point, but can no longer remember a single piece they played? Maybe this even applies to you - it certainly applies to me insofar as I've retained in memory only a small percentage of the many hours of repertoire I learned over the years. Meanwhile there are classical players who have command over dozens of recital programs they can trot out with minimal preparation, and jazz-trained musicians who can improvise pieces that sound like fully premeditated compositions. How do we bridge that gap? Talent has something to do with it, but I'd argue it's less than we tend to think. It has more to do with how you learn and understand music.
The other day I was explaining to my adult beginner why we have focused so much on theory and lead sheets instead of traditional note reading, and I found myself using a new phrase: "playing inside the music." What I mean by this, essentially, is playing like the composer, rather than someone on the outside looking in. This outside perspective was how I played throughout my early career, and I still find myself drifting in that direction out of habit when working on difficult repertoire. But I believe that if you want to have true ownership of the music you're playing, you need to know where it comes from, and if you're in search of more control and consistency, this is where you start.
To begin with, let's agree that learning to read music is difficult, particularly if the piano is your first instrument. One has to learn these arcane and oftentimes unintuitive symbols for pitch, rhythm, articulation, and dynamics, among others - all of which combined is still insufficient to fully communicate meaning. Good interpreters know that merely playing what you see on the page is a quick route to a lackluster performance. The real music is between the lines.
On top of that, pianists in particular have to coordinate polyphony and read two different clefs at once. This diverts our concentration from our ears to our eyes, with the result that we play without fully hearing what we're doing. It sounds crazy, but any piano teacher can tell you how frequently they have to repeat the refrain, "Use your ears!" The brain can only focus on so much at once, and even the audience member, who is not using valuable brainpower to physically produce the notes, is at an advantage.
To add to the confusion, I believe certain traditions of piano pedagogy have encouraged students to play too many difficult pieces before their musicianship is ready to handle it. And I am not talking about emotional maturity in this case. If you want to really master a piece of music, it shouldn't contain more difficult compositional techniques than you would be comfortable writing yourself. For example, if you can't play basic triadic chord progressions by ear, you shouldn't be trying to memorize music with modal mixture and higher extensions (9ths, 11ths, 13ths). If you haven't yet found a necessity for polyrhythms in your own compositions, there's no way they're going to feel natural when you play other people's. It's not your language, and the best you'll be able to do is parrot without understanding, and quickly forget it as soon as it falls into disuse. That's not to say you shouldn't ever learn challenging music to broaden your horizons - just that you should have reasonable expectations about how much mastery you're likely to achieve.
Thus, I encourage my students to play "inside" the music by building up fundamental theoretical understanding from early on in their studies. This starts with basic diatonic chords and progressions, followed immediately by developing the skills of either lead sheet playing, or chord reduction. Chord reduction is reducing a harmony from many arranged notes to a simple three or four-note block chord. In order to do this one needs to be able to hear where the harmony changes, so it takes a bit of practice. However, once chord reduction is well in hand, we can move in the other direction to chord expansion or arrangement, which is where melody plus chords starts to sound like actual music. At this point the student is thinking like a composer, and beginning to understand why every note is where it is. They are conducting the music with their ears instead of their fingers, which is the natural and correct direction, rather than this weird eyes-first reverse engineering process many of us learned as children.
I have just described in a single paragraph what can be a rather lengthy and circuitous process, so please understand that it does take time. However, I believe that it is far more efficient, and leads to better lasting results, than the traditional method of studying notes first, theory last, and arrangement and composition not at all. That's just an incomplete package if you ask me, and I think students deserve more.