When we talk about defilements we are talking about hindrances. When we say hindrance, hindrances are not the things we experience, not the object. It's in the mind that is meditating. If there is greed or aversion in the mind when we practice, if the mind is averse to what is being experienced, or greed or delusion, that is the hindrance, not the experience itself. Having anger is not the hindrance. If we are resistant to the anger, that resistance is the hindrance in the practice. Does that make sense?
But when you understand the practice then you can take the resistance in the mind, and observe that as well, and then it becomes an object and it's not a hindrance any more. It becomes part of the practice.
In the Satipattana Sutta you have body consciousness, feeling consciousness, mind consciousness and dhamma consciousness. When we get to dhamma consciousness then the hindrances become the objects.

TEJANIYA SAYADAW