I don't know that I'd call any of these ideas ways to know a piece more deeply, but they seem to help me play better when I'm away from home and/or don't have sheet music:
(1) Play a piece in a different key, or a different octave. Sometimes both hands shifted an octave or two down or up; sometimes only one hand gets shifted. (Important for learning to play spontaneous duets, but it also tends to detach one's mind from a too-specific sound/muscle memory.)
(2) For simpler or slower pieces, play only one hand, and sing the other hand. (If you have a very limited singing range like I do, sing it in your head.) Then switch hands.
(3) If you've memorized sections of a piece via pure muscle memory, but not the entire thing, play through a section via muscle memory. Immediately after you get to the point where you're not sure where to go next, check the sheet music. Label the next note or chord names in your head, and then go on and play that section through. I think of this as learning to interleave mental memory and muscle memory together to stitch a piece together. I rarely have a complete visual/mental memory of a piece, but I will have a mental memory of the transitions. It's a more compact way to store things in my head. ๐
(4) If you've memorized a piece all the way through, put the sheet music aside for a good while, but continue to play it frequently enough to keep it in memory. After a while (for me, usually a month or so), take up the sheet music again, and try to play the piece while following the sheet music carefully, as if you're trying to check for accuracy & mistakes. I'm always surprised by how difficult it becomes for me to play the piece via sheet music the first time back - the extended time playing only from memory seems to change what my mind does or looks for. Whereas if I just don't play the piece for an entire month, it's a lot easier for me to start playing with the sheet music. I don't know what's going on, but the act of repeatedly switching between muscle memory and reading sheet music, over and over, seems to imprint a piece into my head better.
(5) This last one has nothing to do with learning a piece better, but I think it helps with the different-environment syndrome. It's silly, but I have a long habit of playing "chopsticks" first thing when I'm at a new-to-me piano. Less so now, but definitely in my younger years, if I saw a piano, I played chopsticks on it before going on to anything else. Often while still standing up. If I sat down, I might then play a few measures of whatever came to mind, and it was usually something super-simple. I think of it like getting into a loaner car - everything's different, so you have to adjust the mirrors and seat position, see where the blindspots are, and figure out how the thing accelerates and brakes. I wonder if you might play a few octaves of scales, before playing a piece for your teacher or a however-casual audience, just to acclimate a bit? The thing with "chopsticks" is that it probably was a way of reminding myself not to take myself too seriously. And it has the added benefit of setting the bar low - no one else feels like they have to take me seriously, either, which is how I like it if I'm not playing for myself or a teacher.