This is a good example of Vicarious Learning.
The Vicarious Learning is the process of learning through observation. This concept was conceived by Albert Bandura and indicates that learning does not occur directly, on the contrary, it occurs indirectly through the observation of our parents, peers or society. In this case, the child learns that it is wrong to play a musical instrument according to the feedback it receives.
I hope this information can help you.