I've always said that there are three fundamental aspects to Doctor Who continuity: 1) There are no mistakes, 2) it all joins together, even the bits that seem directly contradictory, and 3) sometimes the bits that explain how it all joins together without any mistakes haven't been written yet. "Head Canon" entries highlight those bits of continuity that haven't been written yet.
The second-to-last Dalek story could really fit anywhere in the Doctor's continuity; after all, the Daleks and the Doctor are both time travelers, and it's distinctly possible that Capaldi could realize he's come along much further into the timeline of his enemies than he's ever been, but the specific incarnation doesn't matter. It's well after the Desolation of Skaro, well after the Movellan Wars, well after the Time Wars, well after the Dalek Civil Wars and the Dalek/Federation Wars and all of the other bloody, nasty conflicts that we've seen over the ages. This is the era of the Final Dalek/Thal War, and it's the worst of them all.
The Thals have been opposing the Daleks from the beginning, of course. Long before the Doctor, a thousand years before the Time Lords made their first strike at opposing the Daleks, the Thals were locked in an unrelenting war with the Kaled race. They've circled round to complete pacifism in their time, and then back again. They've even allied themselves with Davros once before. But now they've been united in their desire to utterly exterminate the Dalek species. And this time, they are willing to do whatever it takes to get the job done.
When the Doctor happens upon them, he finds out that this includes remaking themselves the same way the Daleks did. They've decided that their pacifism has made them weak, unable to finish the Daleks when it was needed, and they've been taking steps to remove their mercy and pity completely. They're becoming monsters, quite willingly, because they now believe that the only thing that can stop a monster like a Dalek is a worse monster.
And the Doctor--reluctantly--helps them. He knows he's playing the part of Davros in the creation of the monstrous versions of the Thals, but he rationalizes it away with the belief that they'd only do it without his advice if he refuses. He assists them in their war, pushing back the Daleks on every front even as he worries about the tendencies towards brutality and cruelty he sees in the once-noble Thals. Until the final offensive. The Daleks are reduced to one planet, one fortress, no time travel, no space travel, no creator, no escape. This time it will be the final end for the Daleks. In twenty minutes, the Thals will bombard the planet from space until nothing living remains.
And then the Doctor discovers why the Daleks have chosen this planet to make their final stand. It has a lost colony of Thals on it. These Thals know nothing of the bitterness and hatred that have consumed their brethren; for them, the Dalek Wars are a thing of the ancient past. They don't even remember space travel. To them, this planet is Skaro.
And so the Doctor acts. With only twenty minutes left in a war that has consumed untold trillions of lives, the Doctor convinces the Thals to meet their lost cousins. The meeting awakens the empathy and compassion that the Thals tried to breed out of themselves forever, and makes them realize what they have lost. They choose the alternative path--they modify the Daleks remaining on the planet to remove their independent power supply, leaving the last Dalek survivors totally dependent on their citadel for life support. They declare this final Dalek fortress to be protected as a testament to their refusal to become their enemies--as debased as these Thal survivors realize they have become, they will not commit genocide. The Thal colony is left on "Skaro" as well, in the hopes that they can someday teach the Daleks another way of living.
And the Doctor is horrified to realize the truth--this is the "Skaro" he visited all those centuries ago, in his first incarnation. Those Daleks he encountered weren't the ancestors of the Daleks, or even an off-shoot of them; they were the last Dalek survivors, the tiny vestiges of a once-dreaded race. And he'd killed them without even knowing what he was doing. The Dalek Wars...all of them...had ended before they'd even begun for the Doctor. And all his efforts to find another way to stop the Daleks? Doomed before they even started.
On the other hand, he decides, at least for some, he knows that the threat of the Daleks is ended forever. For him? Well, that's part of being a Time Lord. He can always find himself in a time or a place where the Daleks aren't gone. Yet.