There is a possibility that I think deserves at least some consideration -- the situation was designed to produce exactly the result that we saw. Specifically:
the Doctor traveled, without TARDIS or other conventional time-travel means, to a place that's at least several billions of years into our future. I suspect that he traveled into the otherwise time-locked Gallifrey.
The Doctor says something like "when they ask who I am, tell them I came the long way 'round." He didn't say "tell them that I'm The Doctor". He didn't say "I'm the Oncoming Storm". For some reason, he thinks that the manner of his arrival is, in this context, the best description of his identity.
The "long way 'round" could easily refer to the absence of time-travel.
The trap was inside (or at least connected to and associated with) a Confession Dial -- probably the Doctor's own Confession Dial. If it is his Dial, that explains why he's pursued by a figure from his own childhood nightmares.
The Veil was not intended to kill him permanently. At least, that wasn't the point of using the trap this time. Maybe that was part of the Dial's original purpose. I'm merely guessing that the Dial's original purpose has something to do with, y'know, confessions . . . .
The Veil was instead intended to give him the motive and possibly the means to continue instantiating himself through the teleporter. In this way, the Doctor can survive truly countless years without regenerating, without aging, without any physical consequence at all.
His escape depends on surviving for at least millions of years. Using the transporter to survive means that he has to practically start from scratch on each iteration, stretching those millions into billions. Whoever trapped him wanted to keep him trapped for a long, long time.
The tougher-than-diamond wall was labeled "HOME". The Doctor assumed that this meant his TARDIS lay beyond the wall, but no TARDIS is in sight when he escapes the trap. If not his TARDIS, what else could HOME mean?
What were they thinking? They were thinking, even hoping, that the Doctor would escape. That could have been the point -- to allow the Doctor to escape to the time and place where the episode ends.
It's possible that someone used Gallifreyian technology -- a device that might have already been connected to Gallifrey's once-upon-a-time unlocked past -- to allow the Doctor to survive the time-lock and exit the trap unharmed.