Purely anecdotal, but I had surgery a few years ago (relatively minor). But I could feel for months after a sort of 'unconscious PSTD' I don't know how else to describe it. Even after it was healed and the pain was gone, there was just a deep sense of 'something bad happened in there' feeling. I'd have dreams of someone digging around in my body. Anyway, it's all gone now, but a weird experience for sure.
I have vivid dreams and smells from a surgery where the visions and feeling of them poking me are incredibly intense. The question is whether it’s a memory or a manifestation of fear. I rarely dream (every few years), but this vivid dream comes through on occasion.
I had the same thoughts "but won't i feel it THEN?" when I was getting an upper endoscopy. The anesthesiologist said you're in such a trance, dreamlike state plus with the inability to form memories its like you're not your real "consciousness" but something different. Sort of like your brain is in "limp mode" and its not really _you._ This was both comforting and slightly terrifying in a different way.
I had a dentist explain to me the same for getting my wisdom teeth out, as if it was a selling feature. At least for me, having my memory wiped is far more scary than just being put unconscious (or having some pain and a local anaesthetic).