A Tzaddik Before Birth?

There was a pregnant woman who smelled food on Yom Kippur. She developed a ravenous desire to eat. If she did not satisfy the craving, it was possible that her life or that of the fetus would be in danger (Yoma 82b). When Rebbi was told of the situation, he advised that they whisper to the woman, “Today is Yom Kippur.” The Meiri says the expectant mother was additionally blessed that if she didn’t eat food on Yom Kippur she would merit a righteous son. The words had their effect, and she indeed did not eat that Yom Kippur. She merited a son who was none other than the great Amora, Rebbe Yochanan.
Rebbi applied the following verse to the incident: “Before you were formed in the womb, I (Hashem) knew you.” The simple explanation of the relevance of the verse is that since the pregnant woman through her sheer willpower withstood her cravings, from that moment she was destined to have a son who was righteous. Rebbi was commenting that even before the child was born, he was already fated to be a tzaddik. However, Rav Yisrael Salanter reportedly offered another explanation.