Indeed. God always knows how to turn a loss into a greater good - as is standard practice for God, who loves us and delights in blessing us and giving us gifts! It can even be said that we don’t lose anything in the end, only gain - likely even more than we lost since God is generous. So we no longer have to fear loss or sacrifice - their bite is only for a time.
It also reminds me of Philippians 4: 10-13: I rejoiced greatly in the Lord that at last you renewed your concern for me. Indeed, you were concerned, but you had no opportunity to show it. I am not saying this because I am in need, for I have learned to be content whatever the circumstances. I know what it is to be in need, and I know what it is to have plenty. I have learned the secret of being content in any and every situation, whether well fed or hungry, whether living in plenty or in want. I can do all this through him who gives me strength.
Of course, Paul isn’t saying that we shouldn’t feel pain & adversity or that we should somehow even like it, but simply that no matter what happens, the core of our joy is in God which cannot be shaken.