Replicating it tends to involve just getting on with the task at hand, without too much thinking about the end goal.
Anything you've practiced sufficiently becomes like breathing or walking. You don't consciously think about these things, you've done them for so long they just happen. The memory of them is so embedded in you that you don't really have to actively work to recall it.
What we call "muscle memory". You've done some actions so often that the action stops being "Put a finger on this fret, pick this string, wait this long, now lift the fretting finger, ..." and becomes "play this song/scale/technique". The whole performance becomes a single action in your mind. It stops being "hit the keys W O R D" and becomes "type 'word'".
And then when you focus on it again, you start noticing the individual actions and you again have to think about every piece of the activity.
I think with you, it sounds like you needed something to lower your inhibitions a bit. Just enough to trust that you're going to do the thing. And normally, you don't trust yourself, so you focus on the steps of the action. It's why people say they perform better after getting slightly inebriated. They're no longer hindered by their inhibitions.
The things that helped me reach that state were motivation, being under slept or slightly tired, being sick.
I didn't have the concept of "flow" at that time, but I remember noticing that flow in important games without having the concept of it. It almost feels like you have to reduce your active conscious thoughts in order to get there, and just allow your instincts to take over.