The Chazal say ״מתוך שלא לשמה בא לשמה״ do a good deed even not for the perfect intention because ultimately you will, deeper is that in the “not great intention” is a great one, although the body tells you one thing the soul says another that’s it’s all for Hashem and that is the true intention, that’s why Hashem promised Avrohom with reward being that it was for Hashem’s honor לקו״ש כ