^ Interesting but arguably a lot of the previous regenerations in the classic series came at points where the show was viewed as being "weak" in terms of ratings : so that's not unprecedented ?
Surely the reason the series has lasted so long is that a change of lead actor and certain amount of format rebooting has usually - not always - helped boost the ratings when they've not been so great ?
The ratings were poor at the end of Hartnell's era, and they actually contemplated getting rid of him a few stories before they did (when he became invisible in The Celestial Toymaker).
Changing to Troughton gave the show a boost.
Similarly Troughton's last season's ratings weren't so great, and then the Earthbound Pertwee and the UNIT set up - quite a change in the series format - gave the ratings a boost.
Tom Baker's final couple of seasons probably weren't as popular with the general public as a whole as his earlier ones ? In the 1980s for me it seemed to become more self-consciously "genre" viewing aimed at fans, rather than a general family audience. This didn't work because the general public's expectations of sci fi as a genre had been totally reinvented by "Star Wars" in cinemas, and by US TV rip offs like Battlestar Galactica and Buck Rogers, not to mention a reinvented Star Trek franchise towards the end of the 80s. As a programme still produced like a stage play almost wholly within a studio with the limited production values that entailed, it could not match these expectations. It was also scheduled ridiculously - midweek in the early evening "soap opera" slot - where it was never going to compete; but still took a surprisingly long amount of time - and Doctors - to actually die ?
Rest it for a few decades and it came back with more general appeal - partly nostalgia of parents watching with their kids. To me, since about middle of Matt Smith's run, if not earlier, it's become again a programme that speaks only to committed fans, becoming too self referential.*
It's currently fashionable in TV to have never-ending franchises that go on and on and on and on, but decades ago Dr Who was very much the exception.
* maybe, though, this is inevitable in our brave new world of subscription services and anti-social media ;where everyone chooses their own programming, their own "facts" , their own "news" ; and cuts off all other media sources that don't fit in with their own preconceptions / bias.