"It serves you right" is usually used with hostility. I wouldn't expect a mother to say this when punishing her child. Assuming the mother is not in an irrational rage, she is punishing the child for his own good. She does not hate him, she loves him. And so this sentence would be inappropriate. It would be more likely to be said by, for example, someone who believes that another person wronged him, and now he sees that person suffering. Like, Al sells Bob a used car. Bob finds all kinds of problems with the car and believes (rightly or wrongly) that Al cheated him on the deal. Then the new car that Al bought breaks down and it costs Al a lot of money to fix it. Bob might say, "Hah hah! It serves you right!"
"You asked for it" is usually used when the speaker is inflicting the punishment. The other two can be used regardless of who or what causes the punishment. Like, Al insults Bob to his face. Bob replies, "You asked for it!" and punches Al in the mouth.
"You deserve it" can be used for both positive and negative things. Like, Al gets a big promotion at work, and his friend Bob says, "You worked hard for it. You deserved it." Or Al gets fired from his job and his enemy Bob smirks and says, "You goofed off all the time and did shoddy work. You deserved it."