Steven Moffat has explained why he gave Matt Smith’s Doctor a cameo in Deep Breath.
He said [via]: “It just felt utterly right for what we were planning for Peter’s Doctor – and right for Matt’s Doctor that he would think of that as he was just about ready to go out the door. And you think, well it’s never been done before – why not?”
“I did wonder. I wondered when we sat in the cutting room, ‘Does this seem strange?’ And then you remember you’re making Doctor Who and you go, ‘Yes this does seem strange – that’s absolutely fine!'”
Moffat also confirmed that the scene was already shot during filming of 2013 Christmas special [via]: “We shot that on the set of Time of the Doctor which meant I had to write that scene first and then fill in some gumph about clockwork robots.”
The scene seems to have divided fans, some feeling it undermined Capaldi’s Doctor. But the man himself was happy with the scene: “I love Matt, I think he’s fantastic. He had a great kind of wisdom about him; he had this great combination of youthfulness and this very old soul, which is very unique, so I was delighted that he showed up.”