Stephen King first got the idea for Doctor Sleep in 1998 at a book signing when somebody asked him what happened to Danny. This was a question King had often asked himself as well as what would have happened to Jack Torrance had he found AA. King started thinking about how old Danny was and where Wendy was now and decided to find the answers with a sequel, but it was a tall order.
Mike Flanagan had to convince Stephen King that, despite his own distaste for Stanley Kubrick's The Shining (1980), audiences were more familiar with that version, and largely preferred it to King's own The Shining (1997). As such, this film had to be a sequel to Kubrick's film and include some direct references to it.
This marks the second time in as many years that Ewan McGregor has played the older version of an iconic role: in 2018 he played Christopher Robin in the Disney movie of the same name. As well, McGregor is most well-known for playing a younger version of an iconic role, namely Obi Wan Kenobi in the Star Wars prequels.
It's very ironic that, unlike Stephen King's book, which is a direct sequel to his novel The Shining, this is a direct sequel to Stanley Kubrick's classic film The Shining, which King famously detests. It also has nothing to do with Stephen King's miniseries starring sit-com actor Steven Weber in the Jack Nicholson role, which is pretty much entirely forgotten and was supposed to be the quintessential version.