Here's my take on it: sex, even just solo sexual activities, are a pleasure available to anyone who wants to utilize it. When it comes to partnered sex, if you're not enjoying it something is off. Could be physical, emotional, or mental, but SOMETHING is amiss. It sounds like you and your boyfriend have some stuff you want to work on and that's good. But please, if you choose to work on your relationship and stay together, make sex one of those things. You should enjoy it. Also, it should NOT be painful. Pain is a sign something is wrong and you need to stop doing it.
Yes, it is normal to think about other people than your significant other while you are masturbating. Maybe it's the fact I'm polyamorous but I think it's really stupid when monogamous people try to control their partner's sexual fantasies. It's so silly to me to think you can suddenly only fantasize about one person because you're with that person. We all still find other people attractive when we're in a relationship. It's just how we're wired.
As for the fact you're mostly thinking of girls rather than your boyfriend, it could be a sign of bisexuality. But really, though, I'd stay away from labels, especially as you are just experimenting with these desires in your mind. Over time you'll figure out more about who you are and what you want. I would suggest entertaining these feelings but not stressing over what to label yourself. In the end you're you and you like what you like.
You're not guilty of anything. Sex and love are complicated issues. They do NOT have to go hand in hand, by which I mean you can not be sexually attracted to someone and still romantically love them. It sounds like you and your boyfriend have some stuff to work on, and as y'all do that it may become clearer where your feelings lie.
Good luck and
PM me if you need anything.