In the long history of humankind (and animal kind too) those who learned to collaborate and improvise most effectively have prevailed.
In the final analysis the questions of why bad things happen to good people transmutes itself into some very different questions no longer asking why something happened but asking how we will respond what we intend to do now that it happened.