Just like Johnny mentioned all this is vipaka for previous kamma we have commited. One thero mentioned a good simili to overcome such situations. This has helped me immensly so I thought I should share it here.
The simili was of a postman delivering letters to us. When a postman delivers a letter we accept the letters without any hatred or attachment to the postman. For example, he may deliver a cheque with a bonus from our employer or a fine for speeding. We wouldn’t hug and throw a party for the postman if he delivers the bonus nor would we assault him if he delivers the fine. Why is is this? It is because we know that the bonus or the fine is something we deserve because of something we did before.
In the same way should try to treat everyone (those who treat us well or scold us) just like a postman, because all of them are only only delivering our bonuses (good vipaka) and fines (bad vipaka) that we rightfully deserve.