What is the connection between being saved and doing something for the nearby city as Yaakov and subsequently Rabbi Shimon Bar Yochai decided to do?
The Ben Yehoyada answers as follows. (you can see it here continued on the next page here). He says that when HKBH performs a miracle for someone, their merit gets reduced (as we learned on daf 32a). However, this is not always true as we see that with some tzadikim HKBH performs miracles for them as a tzedaka. The ability to have the miracles performed for you as a tzedaka is based on the person doing a חסד חינם for others. i.e. some chesed that he gets no benefit from., then מדה כנגד מדה HKBH will do the same for you. This was Rabbi Shimon Bar Yochai’s intent in doing something for the the city. And since he is not a kohen and does not even live there, this purifying of the area from being tamei was purely for their benefit and not his. The Ben Yehoyada shows this is the reason for the derasha about Yaakov being shalem in all these ways that therefore his various takkanos have no benefit for him.
One interesting thing he relates is about the opinion that מטבע תיקן להם. Ben Yehoyada says in the name of the Noda Biyehuda that the people of Shechem had a coin but he convinced them to make it round instead of square. The reason for this was that they should learn that money is a גלגל חוזר בעולם and therefore people should not get too caught up in their money. He says that this is why one of our coins are זוזים since they are זז from person to person.