Indeed, you expressed with perfect words what I wanted to say. Yes I do believe it's more about own insecurities than pure resentment for the other person.
Personally I have felt something similar in the past when I did see a very beautiful woman with an ugly guy or very old man. First thought would be, he is probably rich, that's the reason.. I mean sometime that's actually the reason, but of course much easier to think that instead of exploring your lacks and missings.