"It went from being this song that was maybe gonna be played somewhere in the film to this song that they built this epic battle around," said Ronson, 48, in a new behind-the-scenes featurette titled "Musical Make-Believe," released as Barbie hits streaming.
When director Greta Gerwig tapped him to write a track for Ryan Gosling's Ken, Ronson recalled, "I instantly knew what the Ken song should be."
Once he delivered an initial version to the director, 40, "Greta's like, 'We love that song — actually, can you make it longer?' " he said.
"So we're essentially scoring 11 minutes just around the Ken song," Ronson added.
In the "I'm Just Ken" sequence, the Kens — led by Gosling's and Simu Liu's — face off on the beach, before the scene shifts to a dreamy '80s-esque dance sequence.
In the featurette, Gerwig said she was inspired in part by the "absurdity of" the fight "between the toy soldiers and the rats" in The Nutcracker ballet, which she "loved" growing up.
Gosling, 42, compared the sequence to "the telephone game from the real world."
"It's been distorted by the time it gets back to them, and they're just kind of doing their best but it's really the worst," he added.
Ronson previously said in an interview with Vanity Fair that when Gosling first heard the demo of the “I'm Just Ken," he was such a big fan that he not only agreed to sing the track but also requested to perform it on-screen.
While the producer was worried about how Gerwig would react to the tune — he said he didn’t want her to think he was “trying to provide the funny” — she agreed with Gosling. In fact, she liked the ballad so much that she rewrote a pivotal scene to ensure he could belt it in the film.
After Gosling recorded vocals for the song, Ronson told the outlet he realized the actor (whose musical resume includes his Oscar-nominated La La Land performance, an album with his rock duo Dead Man's Bones and a stint as a Mouseketeer) was a “vocal powerhouse.”
“He really got [that] it had to walk this line of not being funny or parody,” Ronson said. “But obviously, the song is also kind of ridiculous at times. So he was really amazing, and when he really did start hitting the big notes, I was like, ‘This dude is a vocal powerhouse!’ "
Barbie is in theaters and now available to stream, and will hit IMAX theaters for a one-week limited engagement beginning Sept. 22.