To support my previous question ("biblical-genetics-understanding-childs-resemblance-to-his-parents" here's a Talmudic passage (Berakhot.20a):
רַבִּי יוֹחָנָן הֲוָה רְגִיל דַּהֲוָה קָא אָזֵיל וְיָתֵיב אַשַּׁעֲרֵי דִטְבִילָה. אֲמַר: כִּי סָלְקָן בְּנוֹת יִשְׂרָאֵל וְאָתְיָין מִטְּבִילָה, מִסְתַּכְּלָן בִּי, וְנֶהֱוֵי לְהוּ זַרְעָא דְּשַׁפִּירֵי כְּווֹתִי.
Rabbi Yoḥanan was accustomed to go and sit at the gates of the women’s immersion sites. He explained this and said: When the daughters of Israel emerge from their immersion, they will look at me, and will have children as beautiful as I.
So by looking at R'Yohanan women would:
Think of him at the time of relations and thus probably overriding the prohibition of thinking about another person (or maybe that only applies to men?).
Bear kids dissimilar to their fathers and thus causing them to suspect their wives.
put himself into a suspicious position - why would a sage instead of studying Torah sit next to a place where naked women bath.
His intention, on the other hand, was to increase the proportion of nice-looking Jews, which I don't recall being a Mitzvah or a good deed or merit in our tradition.
How is R' Yochanan's behavior explained Halachicly?