My understanding of the Buddhist position on this is that you can reach the first stage of enlightenment (“stream entry”) and still not have purified all of your bad qualities. Compare to eg a religious person who deconverts to atheism, but still has a lot of religious ideas lurking in their metaphysics that they haven’t really examined, or is nervous around the idea of blasphemy.
I think the fourth stage of enlightenment (“arhat”) is by definition supposed to mean you’ve solved all your problems and removed all your bad qualities, but I don’t know how realistic that is or if there’s anybody around who is one.
Also – what bad qualities, exactly? Surely if the Arhat is beating me with a rod, the problem is that I still have impure desires such as “don’t hit me with a rod,” and not any qualities within the Arhat.