I have argued that the notion of derosh vekabel schar, learn and receive a reward, should not be taken to mean that certain laws were only given so that we could learn them lishmah. Rather, these cases carry with them particular educational messages, either regardless of, or due to the fact, that will never happen. My explanation of this in the context of ben sorer u’moreh can be found here. I found that Rabbi Nachum Rabinovitch understood this phrase the same way. It is always nice to have some support. This is the relevant passage.
His full discussion is available here.
The fact that these rules appear in the Torah constitutes an important educational measure. “Expound and receive reward”—one who studies these laws cannot fail to be seized by fear and trembling and will almost certainly be so deeply influenced that some of the perversity in his heart will be cured. Indeed, the very act of engaging with these laws may have the capacity to open blind eyes and deaf ears, so that “all Israel will listen and be afraid.” There is no need whatsoever for such nightmarish punishments to be carried out in the real world. The reward for studying them is their remaining forever theoretical and abstract. Schoolchildren who are aware of the laws of the stubborn and rebellious son will never become one. A community whose adults study the laws of the wayward city can be assured that it will
never give rise to the “root bearing gall and wormwood” of idolatry. And one who has learned to recognize the hand of God in natural phenomena and natural disasters will no longer need afflicted buildings to inspire in him thoughts of repentance. Similarly for all the commandments whose object has already been achieved in the betterment of life in practice; they retain their heuristic force. Even if humanity has progressed and risen above the minimal level that certain commandments were given to ensure, continued study of the laws associated with those commandments can refresh the intellect and direct it to even higher levels, while preserving its existing accomplishments. The idolatrous impulse has departed the world, but study of the laws related to its prohibition can arouse in us a recognition of
genuine spirituality. The more impressed we are by the stringencies imposed in prohibiting idolatry, the more intense our sense of holiness becomes.
How powerful is Torah study? “It was taught in R. Ishmael’s academy: My son, if a vile temptation befalls you, bring it to the study house. If it as stone, it will be crushed; if it is as iron, it will be shattered, as Scripture says, ‘Is not my word like fire, says the Lord, like a hammer that shatters the rock?’ If he is stone he will be obliterated, as Scripture says, ‘O, all who are thirsty, come for water’ and ‘the water wears away the stones.’” A nation that internalizes the Torah’s ideas and values slowly builds up immunity against shameful seductions. Over the course of generations, students of Torah develop modes of critical thinking that can slice through issues, distinguishing illusion from reality, imaginings
from truth, vain puffery from glorious responses to God’s voice. Believers in the Torah build up a stockpile of spiritual strength that enables them to overcome the waves of evil that pound the world and its many internal and external pitfalls. They merit the sobriquet of the nation’s father: “Israel—for you have striven with God and with men and have prevailed.”And that is what the sages meant when they said, “Expound it and be rewarded.” Its cultural legacy transmits from generation to generation a set of qualities that characterize this nation. This is not the place to dwell at length on Israel’s national character, but there is without doubt a common denominator expressing the traits recognizable in our nation. Traces of those qualities linger even within those who have broken away from the Torah’s framework; for at least several generations their hearts remain bound, even in alien environments, to their Jewish sources.