Original Star Wars: Episode IX writer-director Colin Trevorrow did not intend for Jedi Rey (Daisy Ridley) to be revealed as the granddaughter of the vanquished Emperor Palpatine (Ian McDiarmid), who would later return in what would become J.J. Abrams' Star Wars: The Rise of Skywalker. According to reported details of Trevorrow's script penned with Derek Connolly — details which first surfaced on r/StarWarsLeaks on Reddit before the script's legitimacy was independently verified by AV Club — the dead Palpatine only appeared to Kylo Ren (Adam Driver) via a Sith holocron, and Rey would indeed be Rey "no one," as stated by Kylo in Star Wars: The Last Jedi.
In the script, dated Dec. 2016 and titled Duel of the Fates, it's learned Kylo murdered Rey's nobody parents under orders from Snoke (Andy Serkis). Palpatine only appears when Kylo journeys to the burned-out planet of Mustafar, all the while haunted by the spirit of his uncle and former master, Luke Skywalker (Mark Hamill), who would have appeared in a larger role.
The dead Palpatine's hologram recording was intended for his former pupil, Darth Vader, killed when he betrayed the Sith Lord to spare the life of son Luke in Return of the Jedi. A contingency plan, left behind for Vader in the event Palpatine was struck down by the younger Skywalker, reveals Palpatine intended for Vader to take his son to Tor Valum, a master of Sith and Palpatine's teacher.
Kylo then tracks down the ancient and "Lovecraftian"-looking Sith master, who trains the dark-sided Kylo before pitting the son of Leia Organa (Carrie Fisher) and Han Solo (Harrison Ford) against a ghost of his grandfather, Darth Vader in an echo of the Dagobah cave depicted in The Empire Strikes Back. After losing the fight, Kylo is eventually drawn into a confrontation with Rey — already questioning the way of the Jedi and the Force as much as her own place in the galaxy — and it's during this confrontation that Kylo reveals Rey's parents were "nobodies" who died at his hand.
The masked man formerly known as Ben Solo is defeated and subsequently "extinguished," perishing without redemption. This was changed by Abrams and co-writer Chris Terrio, who resurrected Palpatine and had Kylo reveal to Rey that Palpatine is her grandfather; it's later learned Palpatine ordered her parents' deaths, causing her to be abandoned on Jakku.
Terrio previously intimated Palpatine's return was at the behest of Lucasfilm president and producer Kathleen Kennedy. In a past interview, Terrio said the decision was made in part because Terrio and Abrams intended to redeem Kylo, who had already killed villain Snoke in Rian Johnson's Last Jedi — posing a sizable problem for The Rise of Skywalker.
Before the release of The Rise of Skywalker, the fired Trevorrow told Empire he "never considered" bringing back Palpatine.
Star Wars: The Rise of Skywalker is now in theaters.