A theory I posted on Reddit but I'm also posting here since there may be holes and I'd like them to be pointed out if so.
Okay, so a while back, when we first met Momonosuke, we learned that he ate Vegapunk's failed artificial devil fruit. We then saw that as he went hungry, he envisioned Doflamingo as he took off flying. Many people say that it's because Doflamingo can control the eaters of the artificial devil fruits, but the one Momonosuke ate wasn't created by Caesar, but rather Vegapunk, which doesn't make sense as to how Doflamingo would be able to control it. Furthermore, we also know that both Kinemon and Momonosuke ended up at Dressrosa before going to Punk Hazard. Perhaps the events that transpired before Momonosuke got onto the ship was that Doflamingo wiped his memory of something (thanks to the devil fruit user we now know can wipe memories). If that is the case, then it wouldn't be too surprising if Momonosuke visioned Doflamingo just for a second.
This theory may actually tie into another theory, in which Kanjuro, the samurai that Kinemon and Momonosuke want to rescue is actually a traitor, and with the memory wipe, it would explain why they don't remember. I personally believe that Kanjuro is/was going to work with Kaido/Doflamingo to infiltrate Wano Country and allow its control to be turned over to Kaido.
This is something I just thought of, so if there's any problems with it feel free to let me know.