I don't think they "remember" in the sense that we do, but it can set them back to feeling at ease while handled.
Definitely not permanently I don't think. The Borneo Python I used to own needed shots quite often and his mouth cleaned out. That was a struggle. He always just tried to get away, never got aggressive. He never seemed to hold a grudge, either.
I also wouldn't just grab the head and hold it still, that would definitely cause a big struggle and a panicked snake. What I would do is stand near the running faucet (on warm water) and keep running the slightly wet head towel over the face as the snake moves. Let it move. Let it "jump". Let it jerk away. Just calmly keep doing this for as long as the snake will tolerate it without completely freaking out.
The key is to allow them some movement and freedom.
The actual "grab and hold still" I reserve for more pressing matters, such as to remove something out of the mouth or have a good look in there. Or when you have to medicate.
For a stuck piece of shed, some patience and working "with the snake" works best. It just takes a few minutes for the old piece of skin to absorb enough moisture to get soft enough to peel off..