The gemara says that the death of askara begins in the intestines and ends in the mouth because it comes for the sin of bitul torah (rav shimon). The Chachamim challenged Rav Shimon from women, goyim and children who don't have the sin of bitul torah, yet sometimes suffer from askara. The gemara says that women are punished for being mevatel their husbands, goyim for being mevatel jews, and children for being mevatel their fathers.
The idea of punishing women for being mevatel their husband is understandable based on the gemara in Brachos נשים במאי זכיין - where the gemara 17a says the s'char for women is באתנויי גברייהו בי רבנן, that they wait for their husbands to return from the beis midrash. The implication is that although women don't have enough zechus in their own limud hatorah, they are obligated to assist their husbands in limud hatorah which gives them the full zechus of limud hatorah. It would then follow that they are punished for being mevatel their husbands with the full punishment of bitul torah.
The idea of punishing goyim could also be explained based on the gemara in the beginning of avoda zara where the goyim claim to have zechuyos for all the markets and bridges that they constructed (similar to r. yehud bar ilai's position in the upcoming gemara) because it was all done בשביל ישראל שיתעסק באורייתא. This implies that it is incumbent upon the nations of the world to be involved in improving the world to help the Jews be busy with talmud torah. Therefore, if they fail to do this and instead cause bitul torah, they are punished.
However, why would children be punished for being mevatel their father from limud hatorah? Rashi indicates that we are speaking about small children who aren't commanded in keeping mitzvos and unaware of the consequences of their actions, nonetheless they are punished with askara for being mevatel their father. Why? Rav Moshe (Dibros #91) suggests that it is not a punishmet, rather the existence of the world if for the sake of Torah study. When something interferes with the ability to study torah, Hashem responds by removing the interference. Rav Moshe equates this with being a rodef. The person trying to interrupt Torah study is a rodef in the destruction of the world. The halacha of rodef applies even to a child who is not intending to do any harm. Therefore, Hashem takes away the child so that he doesn't prevent the limud hatorah of his father.
In my opinion, Rav Moshe's approach isn't correct. Had the child been removed from the world in a painless way, perhaps it can be understood as a way of removing the obstacle rather than a punishment. But the gemara is focusing on why children die from askara, which implies that there is actually a punishment. Why should innocent children be punished for actions that they are unaware of their consequences?
Just as according to the opinion that children are killed for the sin of nedarim that their father doesn't keep, that is the same idea when it comes to bitul torah. It is not the sin of the child, rather the sin of the parent that the young child suffers for. The father who gives in to the request of his young children and is mevatel torah to grant them every wish, and takes them wherever and whenever they want to go, is punished for not taking his limud hatorah seriously enough. It is an exact parallel to בעון נדרים בנים מתים, where the child is not being punished, the parent is.