YES. But not limited to code, but problems in general. Have been doing this (unintentionally) since I was a child - like a semi lucid state. It kinda sucks cause I sleep like shit.
When I’ve asked others if they’ve ever done this, I get responses like “do you levitate, too?”