Well, verse 12 starts with "therefore" - so it's in conclusion to the verses that come before it...
Matthew 7:7-12: “Ask, and it will be given to you; seek, and you will find; knock, and it will be opened to you. For everyone who asks receives, and he who seeks finds, and to him who knocks it will be opened. Or what man is there among you who, if his son asks for bread, will give him a stone? Or if he asks for a fish, will he give him a serpent? If you then, being evil, know how to give good gifts to your children, how much more will your Father who is in heaven give good things to those who ask Him!......... Therefore, whatever you want men to do to you, do also to them, for this is the Law and the Prophets"
Because of God's goodness and faithfulness in giving good gifts to His children, we're also to do good to others.
It's easier to forgive others when God had mercy on us, even though we did not deserve it.
The focus here is on love.
Other scriptures that come to mind, in relation to this...
Matthew 5:43-48: “You have heard that it was said, ‘You shall love your neighbor and hate your enemy.’ But I say to you, love your enemies, bless those who curse you, do good to those who hate you, and pray for those who spitefully use you and persecute you, that you may be sons of your Father in heaven; for He makes His sun rise on the evil and on the good, and sends rain on the just and on the unjust. For if you love those who love you, what reward have you? Do not even the tax collectors do the same? And if you greet your brethren only, what do you do more than others? Do not even the tax collectors do so? Therefore you shall be perfect, just as your Father in heaven is perfect"
Matthew 22:36-40: “Teacher, which is the great commandment in the law?” Jesus said to him, “‘You shall love the Lord your God with all your heart, with all your soul, and with all your mind.’ This is the first and great commandment. And the second is like it: ‘You shall love your neighbor as yourself.’ On these two commandments hang all the Law and the Prophets.”
Leviticus 19:17-18: ‘You shall not hate your brother in your heart. You shall surely rebuke your neighbor, and not bear sin because of him. You shall not take vengeance, nor bear any grudge against the children of your people, but you shall love your neighbor as yourself: I am the Lord"