I simply put the experience down to an unexplained cognitive glitch
That's probably the most likely reason for Deja Vu, some cross firing of long and short term memory. But if you accept that some "cognitive glitches" could cause that, you should also accept that a cognitive glitch could be responsible for giving one some sort of lucidity within a dream state.
Unless you claim that dreams do not exist at all, which we can fairly well prove not to be the case by observing brain activity, (or even just noting that people with various disorders can be observed to talk in their sleep to persons who are not present).
"Tripping" on some psychoactive drugs is probably not too dissimilar to lucid dreaming - a detachment from reality but with some degree of lucidity.
If or not the perception of lucidity happens in real-time is almost unimportant, after all, it is out perception which is most important. How sure can you be that all the time and experiences up to this second actually has happened, and that you did not right now blink into existence perceiving to have all those memories only now at this instant.