It's been said a million times. Divorced parents should not bad-mouth each other. It hurts the children. It has not, however, been said often enough that other family member and friends of divorced parents also should not degrade either parent to or in the presence of children. That also hurts the children.
Children see themselves as half of each parent.
When children hear bad things about one parent, they hear bad things about half of themselves. If they hear bad things about both their parents, they feel that both halves of themselves must be of little worth. I may have a special insight into this issue that comes from my childhood. Maybe some of you have had similar experiences. My father is an only child.