I agree with this. We are always going to have to deal with our cravings. I find The Seven Deadly Sins to be a useful model of what to try to avoid.
This is specifically mentioned in Buddhism as one of the ten hindrances, "sīlabbata-parāmāso," attachment to rules and rituals. In Christianity, this is similar to the idea of works-righteousness which was the basis of Martin Luther's Protestant Reformation. In either case, spiritual practice would be meaningless without passing through the messiness of life and learning from mistakes rather than dwelling on them.
Those feelings are caused by attachment and craving. Learn to let go of your attachments; that's a big part of the "discipline" that's conducive to spiritual practice.