So if you've been around tech, you've probably heard of flow. You know, the state of concentration where you are one with the code, getting stuff done, and the code loves you back. This is also often said to be incredibly fragile: the slightest interruption will cost you 15 minutes, in terms of how long it takes to resume your concentration.
Although I've experienced this enough that I think I understand the process described here, my own experience of flow has much more to do with other people. I use the analogy of improv comedy - I suggest a thing, you say "oh, but what about this other component?", I say "well, let's try an experiment to confirm that idea", you say "ah, and that means we can delete this part of the code" and I say "oh and now that's gone, we can implement this other thing in a more elegant way". If you've heard of the "Yes, And" concept (which originated in improv and has been borrowed to workplaces) this may sound familiar. We're riffing off each other, we're generating ideas and figuring out where to take them, we're bringing in multiple perspectives about what we are trying to accomplish and how we are doing it.
I mentioned this analogy to a co-worker who is a musician in their spare time. And they immediately said "oh yeah, jamming with someone is definitely a thing" (and contrasted it with teaching, which can feel quite different).