It is plain from your post that this has troubled you deeply and that you have waged a long struggle with obsessive thoughts. Let me first express empathy to you and support for your effort to heal what troubles you.
It’s critical to acknowledge that when we are sexually aroused, all logical thinking goes out the window, and through that open window any number of attractions may enter that we later, with clearer minds, find to be deeply disturbing. It never helps us to simply recoil in horror at our own minds, we have to look at what’s happening there. There are many possibilities. Perhaps a feeling of guilt over masturbating clashed unconsciously with a desire to be pure (represented by a Bodhisattva) and that tangled illogically into a sexual fantasy. Perhaps a sexualized Bodhisattva was seen as taboo and therefore exciting, as there is a power rush that comes from breaking sexual taboos. Perhaps your mind was unconsciously testing your own limits of faith to see if you’re willing to degrade a revered personification into a mere sexual aid. Perhaps it’s a mix, perhaps it’s none of the above, but I think it’s worth reflecting upon to try to determine why this thought arose. However, again I stress, don’t expect a totally logical answer. Sexual excitement is not logical, it’s sensory and emotional, which is why we can easily look back at our sexual acts and ask, “Why on earth did I do that?” The answer is because now you’re thinking logically and earlier you were following sensations, and those are two completely different thought processes.
In the end, trying to untangle the “why” is not as important as “so what do I do now?” The core effort for Buddhist laypeople in regard to sexuality is to be constantly aware of rising sensations, remove the fuel if they’re leading in an unhealthy direction, and only allow sensations to progress if they’re leading in healthy, loving directions. Sensations arise in everyone, whether you have OCD or not. The challenge for all of us is to do exactly what you said you’re already doing: “just maintain awareness of them” and let them go. But we can’t do that when we’re caught up in sensual pleasure, literally in the act of masturbation. Had that troubling thought come to you in a calm moment, probably you’d note it and let it go. But once we’re aroused and in the act, it’s much harder to stop the train of thoughts. So what to do now? I bet you already know the answer, it just helps to hear it from others: don’t beat yourself up, don’t be angry at yourself, it wasn’t something you intended to do. Recognize that illogical and disturbing attractions can arise when we give in to sensual pleasure, so we must be skillful at the outset to direct our sexual lives in a loving, healthy direction. When we consciously set that direction toward loving relationships (or if you’re single, on loving fantasies) then there’s much less risk of being pulled off course.
Your fear of a hell rebirth over a single bad moment feels to me like a Christian-influenced punishment mindset – do one thing wrong sexually and that’s it, you’re going to hell. Karma is not punishment meted out by an angry Other. Karma is the cause and effect results of your thoughts and actions. If you obsess over your failures and feel great anxiety, you’re putting yourself in hell right now. If you consistently and intentionally belittled personifications of goodness into sexual objects, that thoughtlessness and slavery to craving would leave you no better than an animal or hungry ghost and perhaps cause such a rebirth. But that’s not you. That’s not what happened. You had a momentary failure and now you’re doing the right thing, you’re working to understand it so you don’t repeat it. People who do that consistently and genuinely don’t need to worry about a bad rebirth. In life, as in meditation, we must constantly work through these failures of focus and intrusions of desire as we progress to stages where we master them more and more. Hope this helps, and best wishes to you.