When Harry Potter was growing up, people did not know why he was the only person to survive the Killing Curse.
“The nature of that prophecy is unknown, although speculation is rife that it concerns Harry Potter, the only person ever known to have survived the Killing Curse, and who is also known to have been at the Ministry on the night in question.”
- Harry Potter and the Half-Blood Prince, Chapter 3 (Will and Won’t)
The fake Mad-Eye Moody (Barty Crouch Jr.) mentioned that Harry was unique and that there was no (known) way to block it.
“Moody swept the dead spider off the desk onto the floor.
‘Not nice,’ he said calmly. ‘Not pleasant. And there’s no counter-curse. There’s no blocking it. Only one known person has ever survived it, and he’s sitting right in front of me.”
- Harry Potter and the Goblet of Fire, Chapter 14 (The Unforgivable Curses)
If people had known that sacrificing one's own life for another conferred protection against the Killing Curse, Barty Crouch would not have said there was no blocking it.
JKR has confirmed that not only was Harry the first to survive, but that even his mother died without knowing the protection she gave him.
MA: Did she know anything about the possible effect of standing in front of Harry?
JKR: No - because as I've tried to make clear in the series, it never happened before. No one ever survived before. And no one, therefore, knew that could happen.
- The Leaky Cauldron and MuggleNet interview (July 16th, 2005)
But a few years later, the real Mad-Eye Moody knew that Lily Potter's sacrifice had protected Harry. He mentioned this while preparing Harry for leaving the house at 4 Privet Drive.
“Now, your mother’s charm will only break under two conditions: when you come of age, or” — Moody gestured around the pristine kitchen — “you no longer call this place home. You and your aunt and uncle are going your separate ways tonight, in the full understanding that you’re never going to live together again, correct?”
Harry nodded.
“So this time, when you leave, there’ll be no going back, and the charm will break the moment you get outside its range. We’re choosing to break it early, because the alternative is waiting for You-Know-Who to come and seize you the moment you turn seventeen.
-Harry Potter and the Deathly Hallows (The Seven Potters).
During Harry's fifth year at Hogwarts, Dumbledore told him of the protective power of a self-sacrifice. More to the point is that he knew it was somehow connected to Lily being a close blood relative of Harry, so he must have known (assumed?) this was possible the day he placed the baby Harry on aunt Petunia's doorstep. Perhaps Dumbledore knew this possible before anyone survived the Killing Curse. But how did he know?
But I knew, too, where Voldemort was weak. And so I made my decision. You would be protected by an ancient magic of which he knows, which he despises, and which he has always, therefore, underestimated — to his cost. I am speaking, of course, of the fact that your mother died to save you. She gave you a lingering protection he never expected, a protection that flows in your veins to this day. I put my trust, therefore, in your mother’s blood. I delivered you to her sister, her only remaining relative.
She may have taken you grudgingly, furiously, unwillingly, bitterly, yet still she took you, and in doing so, she sealed the charm I placed upon you. Your mother’s sacrifice made the bond of blood the strongest shield I could give you.
Order of the Phoenix, Chapter 37.
So when did magic users learn that the only protection against the Killing Curse is for somebody else to sacrifice their lives in love for another?
How could they have learned this when Harry was the first to survive the Killing Curse? It's not as if this kind of sacrifice occurs often enough for people to understand the effects of it. To my best knowledge, the second time it occurred was when Harry sacrificed himself to Voldemort in the Forbidden Forest to confer protection for the defenders in the Battle of Hogwarts.
Harry explained the protection to Voldemort during their final confrontation.
“You won’t be killing anyone else tonight,’ said Harry as they circled, and stared into each other’s eyes, green into red. ‘You won’t be able to kill any of them, ever again. Don’t you get it? I was ready to die to stop you hurting these people –’
‘But you did not!’
‘– I meant to, and that’s what did it. I’ve done what my mother did. They’re protected from you. Haven’t you noticed how none of the spells you put on them are binding? You can’t torture them. You can’t touch them. You don’t learn from your mistakes, Riddle, do you?”
- Harry Potter and the Deathly Hallows, Chapter 36 (The Flaw in the Plan)
I'm looking for answers supported by quotes from canon sources or quotes from the author.
Side note: I am curious how Mad-Eye Moody learned not only that a love-sacrifice confers such protection, but also that the protection ends for underage people when they become adults or when they leave a family home forever.