Doctor Who emerged from the television wilderness to regain its place as the country’s best-loved drama in the space of less than three years.