John Calvin explains the reason we must love others regardless of how they treat us:
But Scripture subjoins a most excellent reason, when it tells us that we are not to look to what men in themselves deserve, but to attend to the image of God, which exists in all, and to which we owe all honor and love. But in those who are of the household of faith, the same rule is to be more carefully observed, inasmuch as that image is renewed and restored in them by the Spirit of Christ. Therefore, whoever be the man that is presented to you as needing your assistance, you have no ground for declining to give it to him. Say he is a stranger. The Lord has given him a mark which ought to be familiar to you: for which reason he forbids you to despise your own flesh (Gal. 6:10). Say he is mean and of no consideration. The Lord points him out as one whom he has distinguished by the luster of his own image (Isaiah 58:7). Say that you are bound to him by no ties of duty. The Lord has substituted him as it were into his own place, that in him you may recognize the many great obligations under which the Lord has laid you to himself. Say that he is unworthy of your least exertion on his account; but the image of God, by which he is recommended to you, is worthy of yourself and all your exertions. But if he not only merits no good, but has provoked you by injury and mischief, still this is no good reason why you should not embrace him in love, and visit him with offices of love. He has deserved very differently from me, you will say. But what has the Lord deserved? Whatever injury he has done you, when he enjoins you to forgive him, he certainly means that it should be imputed to himself. In this way only we attain to what is not to say difficult but altogether against nature, to love those that hate us, render good for evil, and blessing for cursing, remembering that we are not to reflect on the wickedness of men, but look to the image of God in them, an image which, covering and obliterating their faults, should by its beauty and dignity allure us to love and embrace them.