Easier said than done in practice, particularly when dealing with smaller children, who either can't articulate the problem, or don't grasp the causal connections. Even more so when the unwanted behavior isn't just "weird", but also self-harming (and very abnormal behavior is often socially self-harming).