You're confusing detaching with disengaging. Detaching is all about managing your own emotions/feelings. Disengaging is not being a part of someone else's life. Do you want to be a part of your kids lives? If so, you need to detach emotionally from your W so that her actions don't affect your interactions with your kids.
Here's a link to a great site explaining detachment: