Might be a future incarnation, after all we where travelling in the Doctors own timeline, so it is possible that the Doctor had access to memories he hasn't yet made.
Without getting into a paradox - how does he have the secret *before* he actually travels into his own time-line? That would be a fairly lousy cop-out for the audience.
It doesn't really work either for dramatic purposes because something the Doctor has done in his past and is ashamed of is more powerful than something he could do in the future because that just becomes another version of the Valyard - of interest to spotters but not particularly satisfying as an arc.