The gemara concludes that the machlokes between Beis Shamai and Beis Hillel as to whether on is allowed to carry out a child, lulav ans sefer torah to reshus harabim is dependent upon whether we say mi'toch - מתוך שהותרה לצורך הותרה נמי שלא לצורך - since it is permitted for pikuach nefesh, it is also permitted for non-pikuach nefesh purposes.
Rashi explains that when we apply mi'toch, we completely permit the melacha to be done regardless of the intent or purpose that it is being done for. However, the Rabbonon were go'zer to prohibit things that are not necessary for yom tov. Therefore, carrying out stones on yom tov for no purpose to the reshus harabim would be an issur d'rabonon, and they were even gozer that stones should be muktzah to prevent someone from carrying them out. It would seem clear that according to Rashi, even a minimal need would qualify as a "tzorech" to be matir the issur d'rabonon. Therefore, the case of carrying out a child would even include carrying out a child for leisure purposes. However, Tosafos strongly disagrees with Rashi. Their main source is that when one cooks from Y.T. for chol, if not for ho'il the implication is that it would be an issur d'oraysa. Why don't we use mitoch to reduce it from being an issur d'oraysa to just an issur d'rabonon, even without ho'il? Tosafos holds that mitoch only applies on a d'oraysa level when it is a tzorech ha'yom. When the melacha is done for a purpose that is not a tzorech ha'yom, we cannot even apply mitoch on a Torah level, therefore it would be a Torah violation of the melacha. When we say מתוך שהותרה לצורך, הותרה נמי שלא לצורך, that just means that it doesn't need to be a tzorech of ochel nefesh, but id does need to be a tzorech hayom. Since according to Tosafos we require it to be a tzorech hayom to remove the issur d'oraysa, Tosafos would require that it be a significant need. Therefore, Tosafos makes teh case of carrying out a child to be for the purpose of bris milah. Since it is for the purpose of a mitzvah, it is considered tzorech hayom. Tosafos would hold that leisure purposes would not suffice to remove the issur d'oraysa. Tosafos concludes by quoting a more lenient opinion that considers even a leisurely stroll to be tzorech hayom and sufficient grounds to apply mitoch.
The continuation of the gemara seems to more easily conform to Rashi's approach. The gemara assumes that when one cooks gid hanashe on yom tov we can also apply mitoch to remove the violation for cooking on Yom Tov. According to Rashi, this is very understandable because we say mitoch even on things which are not at all a tzorech hayom, and would therefore apply to even non-kosher food. Tosafos on the other hand struggles with why the gemara applies mitoch to a case where the food is not technically kosher. Tosafos says that although he is not allowed to eat it, he nonetheless intends to eat it, therefore we can apply mitoch. The difficulty with this approach is that if we consider his interest in eating it to consider it a tzorech hayom, it should not only be considered a tzorech hayom, it should be considered אוכל נפש literally, and therefore permitted without mitoch, and even permitted according to Beis Shamai. We are forced to say that Tosafos holds that non-kosher food can never be considered ochel nefesh, but if he intends to violate the issur it would be considered a tzorech hayom that through mitoch would remove the issur d'oraysa for cooking on yom tov.