Which Doctor Who stories have plots based on existing stories from literature or legend? I don't mean stories that explain elements from real-world myths (such as "The Time Monster"). I mean stories, like "The Androids of Tara," which is The Prisoner of Zenda, with the role of the original protagonist taken by the Doctor, Romana, and multiple robots. The other example I know of is "The Horns of Nimon," but I am wondering if there are any others, especially in the revived series.
- The Seventh Doctor adventure Paradise Towers was obviously inspired by J.G. Ballard's novel High-Rise.
- The second ever serial, the first Dalek story, bore a strong resemblance to H.G. Wells's short novel The Time Machine, or at least the 1960 film adaptation, with the Daleks playing the role of the Morlocks and the Thals the Eloi.
- Many other Doctor Who episodes contained plot elements "borrowed" from books, films and TV series.
- Third Doctor serial Inferno was reminiscent of Arthur Conan Doyle's Professor Challenger story When The World Screamed, and The Daemons was reminiscent of Quatermas and the Pit and Childhood's End.
- Fourth Doctor story Robot borrowed from King Kong, the following story The Ark in Space had a character called Noah as an open acknowledgement of the resemblance to the biblical story of Noah's Ark.
- Meanwhile two of the stories mentioned in the question, The Time Monster and The Horns of Nimon, play with the Theseus and the Minotaur legend, as do
- The Space Museum (1st Doctor),
- The Mind Robber (2nd Doctor),
- Death to the Daleks (3rd Doctor),
- Pyramids of Mars (4th Doctor) and
- Castrovalva (5th Doctor).
- The Brain of Morbius owes a lot to Frankenstein, or at least the better-known film versions.
No specific examples in the modern series, but the episode The Unicorn and The Wasp (Series 4, episode 7) while not based on a single story is based on a 'class' of stories: 'the agatha christie' mystery - it has Agatha Christie as an important character, and makes reference to a real mystery in her life.
Next closest is probably The Doctor, The Widow, and The Wardrobe (Christmas Episode 2011) which has a lot of story beats in common with The Lion The Witch and the Wardrobe. [I discount the previous years A Christmas Carol, as in that the book gives the Doctor the idea of how to change the villain's mind].