This is actually a common psychological tendency called projection. We emphasize traits we dislike in ourselves to other people. We are then driven crazy by these people since their qualities are the ones we try to suppress.
The whole point of projection is to offload feelings that we don’t want to feel. So next time you’re quick to mock someone answer honestly if it’s something you’re insecure about.