An aspect of the "just-world fallacy", where ultimately good things happen to good people, so if a good thing happened to you, you must have been good, etc.

https://en.wikipedia.org/wiki/Just-world_fallacy