I mean, your given example isn't actually an example of your previous points. Its not a "every cloud has a silver linings" statement, it's a "I still believe in God even when bad things happen. This isn't proof of neither his non-existence or his non-caring." Eve your example is a poor thought experiment because it assumes a limited power god who can only break your foot, but can't actually prevent the drink driving accident in any less painful way.
It's a "I'm going to pretend this was supposed to happen and is a good thing regardless of whether good things come from it."
It's the response to "earthquake kills 1000s".
The other, less religious reasoning you provided is much more clear and less stretches with a lot better phrases. Even your descriptions would work better than providing the phrase itself to someone who is currently hurting. This phrase ultimately defends the bad thing as a good thing instead of telling the person shit happens, play the cards you were dealt, you can still win even when you're coming from behind.