Loki Ending Was Inspired By Planet of the Apes & Twilight Zone
Loki writer, Eric Martin, claims that the show's finale was heavily inspired by old sci-fi including Planet of the Apes and The Twilight Zone.

Loki’s ending was heavily inspired by classic science-fiction, chiefly Planet of the Apes and The Twilight Zone, according to one of the show’s writers. The Twilight Zone was renown for its bizarre premises that often ended on somewhat downbeat endings that left the audience thinking about the ethical and moral questions raised in the episode they had just watched. Likewise, Planet of the Apes contains one of the greatest and most well-known twist endings, with Charlton Heston’s George Taylor discovering the ruins of the Statue of Liberty, and revealing that the alien world he had landed on was in fact Earth in the future.
In a similar fashion, Loki’s season finale “For All Time. Always,” saw Tom Hiddleston’s titular God of Mischief and his female variant, Sylvie (Sophie Di Martino), confront Jonathan Majors’ enigmatic He Who Remains, aka Nathaniel Richards/Kang the Conqueror in his citadel at the end of time. There, he presented the pair with a Faustian bargain of epic proportions, and an almost impossible decision that would fundamentally shake the multiverse to its core: return to the Time Variance Authority as its leaders and continue protecting the Sacred Timeline, or kill him, thereby freeing the timeline from his control but unleashing chaos. Sylvie chose the latter, but just before killing He Who Remains, she banished Loki back to the TVA where he desperately sought out Owen Wilson’s Mobius only for him to not recognize Loki, and reveal that he had been sent to a branched reality where he never joined the TVA. The closing moments saw Loki staring in disbelief at a statue of He Who Remains in the TVA and left a lot unanswered questions going into season 2.
In what he dubbed “Loki Midnight Theater,” writer and producer Eric Martin took to Twitter to discuss the final episode of the series. During the thread, he revealed a great deal of information about the finale, including what he would have changed if he had more time. Most interestingly, Martin claims that he and showrunner Michael Waldron toyed with several different endings but this one “just felt right.” He also revealed that the ending was greatly inspired by old science fiction stories. See Martin’s tweet below:
That said, it’s good to see a writer acknowledging their inspirations and paying homage to them in a way that suits the series perfectly and doesn’t feel out place – which was certainly the case here. Moreover, Loki’s down-beat ending was something of a breath of fresh-air as it broke with the typical Marvel formula by having the hero ultimately lose, which is not dissimilar to Avengers: Infinity War. Loki’s ending perfectly set up the future of the MCU, and left enough scope for fans to speculate over what is to come in season two and beyond.