what the hell is wrong with me?
You are going through a period of low self-esteem. Frankly, your boyfriend has contributed to this by his actions. BUT, this is your issue to deal with and overcome.
Never compare yourself to someone else. I have found when one does so, one never seems to measure up. Remember, you are beautiful. Not because of how you look on the outside (that beauty tends to fade for everyone) but rather who you are on the inside. If he is so shallow that he would leave you for the next pretty face, then you are better off without him because there will always be a prettier face.
As far as his actions are concerned, if he has stopped messaging and sexting and appears to be focusing on you and the relationship he has with you, then great. Maybe he has realized what he has in you. If he continues or returns to messaging/sexting with others, then frankly, you are better off cutting him loose in order to find someone who values you.