In fairytales the princess is always in need of rescue and when her prince slays the evil dragon saves her from the tower, they live happily ever after.
By slaying the dragon, breaking the spell, or defeating the windmill as the case may be, the prince is going through a lot. He must succeed where everyone else has failed, a challenge hard enough to prove his valour and worth. To the princess waiting to be rescued, it proves her worth too. She must know how hard it is to get through to her, after all who in their right mind goes after a dragon and to statistically guaranteed death? The test of valour ends there, before scaling the tower and rescuing the princess. That extra distance her prince is going for her.
There are many flaws to fairytales, but the happily ever after makes more sense. If going forth to statistically guaranteed slow, painful, and torturous death, slaying the dragon/spell/windmill holding her captive, and then climbing a tower all in hope of rescuing the princess is not a sign of love and devotion then what is? Part of it can be written off as tests of princely character, but the rest is still far too taxing to just be after sex.
If a man is willing to endure the most extreme tests of his physical, mental, and whatever else the story contains character for someone, he has most certainly proven how much this person means to him.