"Muscle memory." I hate the phrase. It is misused. Your muscles have no memory, it is your brain which controls them. When you play the piano, it is not the muscles in your hand playing, it is your brain. If we swapped brains, once our brains figured out the new measurements, our techniques would transfer, too. Like a teenager who trips over the floor or falls walking up stairs, it is because their tendons and bones grew and the brain needs to figure out the new measurements. The kid isn't clumsy, his brain is in a new body. That is why you never forget how to ride a bike despite not "practicing" for years, getting fat, getting skinny, growing or getting old. Your brain has hardwired how to balance and commands the ancillary muscles to make it so. The muscles are just the engine. If you stood on one leg and looked at your foot, ankle and calves, you will see (if you have low body fat) your brain using your muscles and tendons to maintain balance. Your muscles are not doing that, your brain is. Likewise, when you play the piano, it is not your finger nor hands but, your brain. This is where many teachers and students go wrong because they focus on brow beating the fingers into submission when really they should cultivate proper movement from the mind where movement originates.
When you first touch a piano, your brain hard wires or makes neural pathways on how to use the muscles and tendons to make a bone strike a key. That is so called muscle memory. So, you had better make that first movement correct and ergonomic because if there are any improper movements associated, those are hard wired, too. This is why some people have lifetime technique issues because it is already in the brain to be that way. Improper movement is very difficult to eradicate for other reasons I won't get into.
Never "memorize" a song by playing it mindlessly a hundred times. That is not memory at all. It is your ear, patterns and guesswork. If you don't maintain playing it, it will atrophy and you will forget it. It is not memory because if you get nervous or loose your place, it is gone and so is your performance. I've seen it a hundred times. It literally means you do not know what you are doing and are guessing.
So per your question what to think about. There are several skills which must come together and crosspollinate with one another. I advocate that you forget your letter training and instead think of notes in the scale as numbers. CEG is absolute but 135 can be anything. It can be FAC, GBD, BbDF . . . . Playing by numbers is also the secret to sight transposing, improvisation and "memorization." NONE of it is thoughtless or hocus pocus. It is all in the brain.
Then, train your ear to know what the numbers sound like. For instance, I just know that Blue Moon starts on the 5th. Mary had a Little Lamb on the 3rd. Joy To the World 8th. Happy Birthday on the 5th. Star Wars is 1 to 5. Once you train your brain and ear to know any degree of the scale, you will just know what the notes are and never have to memorize or see the music because your brain's ear will know how the song goes and your brain will just know what the notes are. Like spelling. You know the basic rules, how to sound out, the alphabet and if you heard the word cat, catacomb, catatonic . . . you will either just know how to spell it or your brain can figure it out based upon crosspollinated knowledge and calculations. You use your ear and knowledge of the alphabet to figure it out. You don't have memorized every word but you can figure them out.
When I memorize a classical piece, I will listen to it once to get it into my mind's ear, then play it to assess trouble spots, then go sit by the pool with the score and study the melody and its intervals. I'll study the chord progression, voicing's, key changes and counterpoints. Then after a few hours, without the score I will go play it. Then back to the pool to study problem parts. After doing this for a few days, the piece is mine. It isn't memorized but, combined with my ear, being able to read in my mind what my brain hears, knowing where every note is going and I admit, a dab or rote tossed in, I will never forget the song. I can also sit down with pen and paper and write it out because my ear can see the score.
Pop songs or standards are different. Since I "fake" those, all I need to do is hear the melody for my mind's ear to just know what the notes are. Pick any note on the keyboard and play Happy Birthday. That first note will by your 5th so you now know what key you are in. Then, don't guess, hear each note in your head and calculate what the notes are. It is amazing how when people "hunt and peck" that melody, how many miss the octave. You should never make a mistake playing a melody that simple if you know what you are doing. If you make a mistake, you are guessing.
There is nothing mystical about making music. You can close your eyes and let rote take over and just regurgitate patterns or, know what you are doing, craft a solo, build to a climax, develop a mood or a variation. That is why the greatest musicians seemingly don't make mistakes because they know what they are doing and are not guessing.
When I teach students this method, I start with just focusing on 135 and use Mary Had a Little Lamb. Sing it. It starts on the third. Don't guess, know. Even if it takes time. Do it away from the piano. You should get these numbers: 3212333 222 355 3212333322321. Now go to the piano and start on the third tone of ANY key. Don't guess, know. YOU will know if you are cheating. One hour away from the piano is worth more than five hours at it.
Congratulations. You are combining brain, ear and fingers to "memorize" music and you are on your way not to be a musician but, an artist.
Also, the issue of technique is also in the brain, not a Hanon exercise or hours of practice. You only need to hard wire proper movement unless you've already hardwired improper movement.