The Twelfth Doctor isn't the Valeyard. The Valeyard is created when the Doctor regenerates into his Thirteenth incarnation. Since Gallifrey is gone it may now change that but its likely the Valeyard's involvement in the Doctor's trials etc are fixed moments and all happen before the destruction of Gallifrey.
We don't know how the time lock on the war works. It prevents time travel into and out of the war (except for a few accidental instances) but may not prevent time travel that "skips over" the war without affecting it. The Valeyard might be able to reach prewar Gallifrey but be prevented from taking actions that would affect the war -- such as giving the Time Lords warning of what was going to happen.
Also, in The End of Time, the Doctor specifically states that "something that was already there" (when the time lock was imposed) would be unaffected by the lock. That is why the four-beat signal in the Master's head could act as a link to let the Time Lords escape. If the Valeyard's presence on prewar Gallifrey is "something that was already there", it too would be unaffected by the lock.
It is possible that the two paragraphs above are merely different ways of saying the same thing. Find a Time Lord and ask.