We now have in-universe confirmation (from the film's official novelisation) that the Palpatine we see in Rise of Skywalker was a clone of the Emperor, not the original. The "corruption" we see in his body is caused by the clone body being unable to contain his dark side Force powers.
"All the vials were empty of liquid save one, which was nearly depleted. Kylo peered closer. He'd seen this apparatus before, too, when he'd studied the Clone Wars as a boy. The liquid flowing into the living nightmare before him was fighting a losing battle to sustain the Emperor's putrid flesh.
"What could you give me?" Kylo asked. Emperor Palpatine lived, after a fashion, and Kylo could feel in his very bones that this clone body sheltered the Emperor's actual spirit. It was an imperfect vessel, though, unable to contain his immense power. It couldn't last much longer."
Star Wars Confirms Palpatine Was A Clone In Rise Of Skywalker
Obviously this was planned in advance by Palpatine so he could gain some measure of immortality. We also have confirmation that the First Order (and Final Order) were already being planned for by the Emperor in advance of his 'death', hence why large manufacturing facilities had been hidden in the Uncharted Territories ready to produce even bigger and better ships and weapons.
As to whether there was any out-of-universe advance planning to have Palpatine return, the simplest answer is that there are conflicting reports from the makers of the film.
Colin Trevorrow (who wrote the initial script draft) has stated that he had no intention of adding Palpatine to the film and that the idea was entirely JJ Abrams' and added in the rewrite.
Although Trevorrow had an impactful hand on Rise of Skywalker, the
decision to return Palpatine was entirely the idea of Abrams.
"It is really something I have never thought of." Trevorrow admitted.
"This was a difficult story to unlock and he found the key."
It was JJ Abrams' idea to return Palpatine to Star Wars: The Rise of Skywalker
However, Chris Terrio (brought in to support the scriptwriting) claims that Palpatine was always mooted to be in the final film.
Via Colin Trevorrow, we first learned that JJ Abrams wanted the
Emperor to return for the conclusion, but in an interview with Awards
Daily writer Chris Terrio discusses that this is not entirely the
Terrio says that Lucas film President Kathleen Kennedy wanted
Palpatine to return. "Kathy Kennedy and Michelle Rejwan had a clear
plan about how everything should end," said Terrio. "They had clear
plans about certain storylines that we had to use. We were given a lot
of freedom within that. We knew that Rey and Ren were the key to this
trilogy, but we also knew that we had to make a path in which Kylo Ren
could regain his honor since he is the son of Han and Leia. "
"That's the point that we started to play with the idea that there was
an old evil that didn't want to die," he went on. "The source of evil
in the universe is the dark spirit waiting for revenge and quietly
awaiting its time. The entity known as Palpatine in this version - its
original body died in Return of the Jedi - is very patient and waits
He dug his pit and waited to return and take over the world again."
Star Wars: Palpatine's return to TROS was the idea of Kathleen Kennedy
Personally, I feel that it's unlikely that Lucasfilm always intended Palpatine to be in the final film but didn't tell the guy who was writing the film that he was going to be a major character in it.