They should've retreated, left Bran to be captured (and used him for some lore ffs), set Winterfell on fire and head south.
After miserable weeks being chased by the others, they'd arrive at King's Landing only to be met by Cersei's army. After some convolution and some deaths, Jaime would kill Cersei (now the Queen Slayer) and take control over the Lannister army.
Arya could then kill Euron using Cersei's face, and hand the fleet to Asha.
The final battle, second round against Death, would then follow.
The white walkers were supposed to be the greatest threat to humanity, this episode was stupid as fuck.