טף למה באין, כדי ליתן שכר למביאיהן
The Gemoro asks why were infants brought to the Mitzvah
of Hakhel. The Gemoro answers, to reward the
the ones who brought them. (the parents)
From this Gemoro it seems, there is no benefit for infants,
to be brought to the Bais Hamidrash just to listen to the learning.
Otherwise, the simple answer should have been they came
to listen so to have the Torah absorbed in them.
How do we explain Chazal ( Yerushalmi Yevamos 8b) The mother of
R. Yehoshua brought him in his crib (infant) into the Bais Haknesess
so his ears will be attached to Torah.
Mori V’rabi Harav Hagaon R. Shlomo Miller Shlita said , The Gemoro
holds, there is no benefit for a child who doesn’t understand,
to listen to Torah learning.. Torah doesn’t get absorbed just by listening,
without understanding it.
That is the reason of the Gemoro asks why bother bringing infants.
The Gemoro answers, Hashem rewards parents who believe it will benefit
the child and therefore brings the child to the Bais Hamedrash,.
The reward is they do benefit and become Talmidei Chachamim.
The Torah does gets absorbed in them.This is the reward שכר למביאיהן
Since the Segulah only works as a reward, for the effort to bring the child to listen and absorb Torah
If the child was brought to Shul not for that purpose but for other reasons such as to give the mother a break so she could have a rest etc,, this child will not benefit listening to Torah being learnt.
in the Bais Hamedrash since he doesn't understand and the parents
will not be rewarded for bringing them.