Not only is this related to OCD; it may very well be the essential behavior that prolongs the existence of OCD.
Basically, it comes down to this, the more you avoid what you are afraid of, the more you teach yourself that the only way to be safe is to continue to avoid it.
Therefore, avoidance begets more avoidance. As avoidance behaviors are allowed to continue unchecked, they will lead to more and more rituals, as well as possibly more involved rituals, such as adding more steps to the ritual or having to do the ritual for longer and longer periods of time to reach the desired calm.
Eliminating the avoidance of your fears is the focus of exposure therapy, you are gradually reintroduced to the objects or situations you have been avoiding.
This therapy is designed to get people to go back to doing the things that the obsessions tell them are dangerous so that they can see that just thinking something does not mean it is true or has a greater chance of becoming real.