I think we might be interpreting the text differently:
The dragon egg is surprisingly resilient. Fire doesn’t harm it, a fall won’t break it, and nonmagical weapons can’t crack it. Despite the egg’s natural resilience, Ervan won’t risk damaging the egg by attacking Player Characters near it. If the characters seize the egg, Ervan yells, “Thieves!” Before Ervan can take further action, Cinderhowl catches sight of him and flies toward the tower. Continue with scene 6.
Scene 6: The Dragon
The adventure concludes with a double “boss fight.” The Player Characters must deal with two foes at once: Cinderhowl and Ervan Soulfallen. Clever characters can turn one of these foes against the other.
Cinderhowl is a hostile adult red dragon who speaks Common (the language of common folk) and Draconic (the language of dragons). Her senses are excellent, and hiding the egg from her is nearly impossible. She accuses those closest to the egg of being thieves and threatens to roast them alive unless the egg is given to her at once.
Nothing the Player Characters say can quench Cinderhowl’s rage. The dragon is convinced Ervan hired them to steal her egg. As an action, a character can try to redirect Cinderhowl’s rage toward Ervan, doing so with a successful DC 20 Charisma (Deception or Persuasion) check. Use whichever skill seems most appropriate.
If Cinderhowl was lured to the tower by the Orb of Dragonkind (see scene 5), the dragon tries to kill whoever has the orb after the egg is safely in her custody. If a Player Character willingly gives her the orb, Cinderhowl keeps it while granting nothing in return.
If Cinderhowl regains the egg but seems on the verge of losing the battle, she takes the egg back to her mountain lair after warning the Player Characters that she will haunt their nightmares.
Conclusion
If the Player Characters defeat Ervan and Cinderhowl, Alax Jadescales prepares a banquet that includes platters of mouth-watering, all-you-can-eat hot wings. The Player Characters are welcome to stay at the Inn Plain Sight whenever they like
If she was lured by the Orb, she will kill whoever has it- if it's given to her, she keeps it while granting nothing in return.
I imagine that's the part that's making you think "if she gets the orb and the egg she'll leave."
Nothing can quench Cinderhowl's rage.
If Cinderhowl regains the egg but seems on the verge of losing, she leaves after threatening the PCs with revenge.
As per "Conclusion," for our happy ending the PCs have to defeat both Ervan and Cinderhowl.