When my wife reprimand or beat up my younger son, I have observed that our dog would attack my wife. Our dog loves our youngest son most, even she treat my wife as the 2nd in the pack. She would still defend our youngest son.
I think once you gain the loyalty of a dog. It is for life.