Those two にs have different functions. In my example sentence, に indicates the target of 備える. It doesn't associate with 備蓄する.
On the other hand, に indicates the time when the action 経験する is done in the original sentence.
The "purpose" is not always mentioned. Or rather, it's more common the the context gives it. For instance, 非常食を備蓄しておく is obviously for emergency even without 災害に備えて. 子どものときに経験しておけばいいこと refers to the experience that would be helpful in adulthood, things that would be better to experience in childhood than in adulthood or like that. Thus, your translation is correct.