It does seem to be kind of similar to the "zone" in programming, it's not uncommon to finish a task you were planning and just to keep in the zone I started doing extra features, many times that would be scrapped later because it was not relevant but just due to the inertia and to not have to switch context.
There's also an interesting question there regarding adhd and gambling, I'd imagine the hyper fixation would definitely make the issue more acute. A quick search got me this[0] meta-study which seems to find some link between adhd symptoms and problem gambling, I'm no medical scholar however so don't take my word for it.