FWIW, this sort of issue is a serious problem for many people with severe OCD. Basically a thought comes into their minds, about something disturbing or taboo, and they start obsessing over the fact they had the thought, because they're so distraught about the idea it would even come into their mind. In most cases, they are so far from actually doing anything related to the thought, and that's why they are so distraught. This leads to penitential behavior, and compulsions, etc.
Sometimes figuring out if they're just obsessing because they're worried about a thought, versus actually perseverating over a potentially actionable drive, is really really difficult.
Not saying you have OCD, it's just a whole area that can lead to seriously debilitating problems for some individuals.