How to intellectually learn music instead of relying on muscle memory?

I've been playing piano for about a year and practicing daily. When I learn a piece, I mainly focus on deciphering the sheet music and repeating it until I can play it at the correct tempo.

However, I’ve been experiencing memory slips, and I think it's because I don’t fully understand the theory behind the music. This makes it harder to truly learn the piece.

How can I better engage with and understand the music on a deeper level? Where can I improve this skill? I’m feeling frustrated for not having thought about this sooner and wasting lots of practice time.