Dude I can't believe you just described that phenomenon, I get something so similar from pretty much any GABAergic rebound/withdrawal, when trying to sleep. I've never been able to describe it well. It has happened from phenibut/gabapentin withdrawal, as well as GHB (really bad with GHB), and benzo rebound/withdrawal. It is like my brain becomes incredibly obsessive-compulsive and I start having a semi-dream where I am still somewhat awake but it consists of replaying a tedious and complex/abstract/strange scenario, or like I have to solve a puzzle that gets more complex the more I work at it. It is extremely annoying and somewhat alarming feeling and it makes it so hard to sleep or feel comfortable. So hard to describe, and weird, but your account is the first I've read that seems to describe something similar.