When I was working (in therapy), I kept meaning to write a book about guilt, as it is so mega, so pervasive. However, didn't get round to it, I am very very bad, lazy.
Some people argue that religious ritual helps people with guilt, as it says, you are forgiven, however, on the other hand it reinforces it, esp. Protestantism, which seemed to take a ferocious turn, for some reason. Although the Catholics could also be fierce.
There's also the issue of control, as the church used to have a kind of monopoly of these things, via confession and so on. Thank goodness it has been secularized.