Singer-songwriter Michael Stipe has known Elton John for more than 35 years. In all that time, he had never once given Stipe’s personal phone number to anyone, especially a musician. Then he decided to break the rules. “He gave my number to Andrew Watt, who texted me and said, ‘I have an idea,’” Stipe recalls.

The idea was for the opening title song of “Rooster,” the HBO dramedy starring Steve Carell as a college writer-in-residence who slides back into his own student-era restlessness. The series, created by Bill Lawrence and Matt Tarses, needed roughly 30 to 45 seconds of music to play between episodes. Watt and Stipe wrote an entire song anyway. Thus was born the theme, “I Played the Fool.”

The duo has eight Grammy Awards between them: Stipe has three as the frontman for the band R.E.M., while Watt has five for collaborations with Ozzy Osbourne, the Rolling Stones and, most recently, Lady Gaga on “Mayhem.” “That’s what we know how to do,” Watt tells Variety. “We could have just said, alright, they need 30 seconds, let’s just do that. But we didn’t. We wrote a song that had a beginning, middle, end and an arc. It was incredible to watch Michael weave that together.”

For Stipe, who has been deliberate about how he re-enters the recorded music world since R.E.M. dismantled in 2011, the proposition came as both a leap and an honor. He has never been a solo artist in any sustained way before, and writing in a character’s voice for someone else’s show meant accepting notes from collaborators. “I was jumping off a cliff,” Stipe says. “Andrew and I barely knew each other. I felt like this was something I hadn’t really done before — certainly as a solo artist. And it’s a real challenge for me to write in someone else’s voice and take notes from people like Steve Carell, Andrew Watt and Bill Lawrence. And I did take notes.”

What unlocked the song was the chorus. “As soon as I got the ‘Oh, I played the fool,’ that opened it up for me,” Stipe says, briefly singing the line a cappella. “To think, OK, what’s going on in this guy’s head? How do I get inside of that, and how do I represent this character and his story through a pop song?”Watt, who was coming off the Oscar-nominated title song for the Elton John documentary “Never Too Late,” brought Stipe a piece of music that was initially “a little more detailed.” Stipe had him strip it back to a piano sketch so the chords could carry more weight on their own. “Watching the show, it feels very upbeat, but it also has pain, sadness and emotion to it,” Watt says. “So the idea was trying to make a piece of music that felt upbeat but still had minor chords and made you feel.”

The collaboration has since opened other doors for Stipe, who says the experience of working with Watt has been the headline regardless of any awards recognition that may follow. “If it kicks open the Emmy door a little bit, among all those doors that it’s opened, then I’m absolutely thrilled to stroll in,” Stipe says. “I love the challenge and I love the show, and I’m really proud of the song.”

For Watt, the awards conversation was never the point. “It’s always amazing to be recognized by the people making art and the community, but that was not the reason why we made the song.”I guess Elton John picked the right time to break the rules.

Stipe and Watt are on the Emmys ballot in the category of main title theme. Emmy nomination voting runs through June 22.