That scene was necessary to add weight to what happened last night.
If when Melisandre first approached Stannis and said "Hey, let's sacrifice your daughter" and Stannis turned around and said "LOL, why didn't you say so earlier???" then he's a soulless monster. Not a single viewer of the show would want him to win. Fuck, most people would be rooting for the Boltons at that point.
But the situation at that time didn't call for desperation. Stannis still had a fighting chance when Melisandre first approached him.
Buuuuuut the entire first 10 minutes of this episode were used to build up just how wildly hopeless Stannis' position was. He was already fucked to begin with, between the weather, the desertion, and the dwindling supplies, and then Ramsay's infiltration just made things 100x worse by destroying of Stannis' food and siege weapons.
Ultimately his choice became either sacrifice his daughter or abandon everything.
He's still a soulless monster, but at least he was shown to be conflicted by the situation. Some would call his decision Machiavellian, some would call it unforgivably cruel, but when the choice is either to have one person die, or have everyone die, he made the decision that may ultimately save the most lives.