John is able to weasel his way out of being killed because if he's killed his soul will go to Neron, which would severely anger Hell's Triumvirate who all want their hands on him. This is a nod to one of John's most famous stories in the comics where, dying of cancer, he offered his soul to each member of the Triumvirate and they were forced to let him go, lest they let war breakout among them.
The ending of the episode is very similar to Zari (2017), in which a younger version of a Legend encounters and befriends a baby creature which is unseen by the audience until the next episode.
John saving Astra is taken directly from the comics, specially Hellblazer #96.
John said he would sacrifice the Legends if he could save Astra, referring to the episode Hell no, Dolly (2018), this may also be a reference to Necromancing the Stone (2018); when Mallus tricked Sara into using the Death totem and ended up possessing her, Mallus said he'd free Astra from Hell, but Constantine would have to let him have Sara in exchange. John knew Mallus would never really get Astra back, and thus, rejected the offer. However, when Sara asked John if he'd have traded her for Astra if Mallus really would free the latter, John said he'd have done it in a heartbeat.