Like you said, it can probably console people that believe in that sort of stuff and probably is meant like that but you gotta be careful with it if you ask me. I can easily be damaging.
If you think about it, the bible and other books/religions were created in really hard and tough times and the belief that somehow in some way "it was meant to be and there's a reason behind this terrible thing happening" was helping them through it. This is all in times in which less was known about how the world around us works (and even nowadays we don't really know but our models are much much better - just think of how medicine knows about bacteria causing illnesses and such vs. the whole Yellow Bile, Black Bile, Phlegm and Blood thing - Hippocrates ~460BC-~370BC).
A merchant in the 1300s coming home to find all of his family had died from the plague might find solace in thinking that all of this happened for a reason if he is a very devout believer in such things. I can't personally fathom how you'd find someone today that would see meaning in having a family member getting infected with Yersinia Pestis, nevermind die from it, but that's just me.
So as you can see, personally I absolutely don't believe in the whole reason and other religious stuff but I can see and appreciate how religion can help stabilize society and keep the population under control in tough times, how it can be a moral compass etc. I don't personally need the rest of it all to know that I shouldn't just go about killing other people. And if something bad happens in the world then - from my relatively safe western vantage point - I can just see that the world is still an ugly place and that there are bad people that just do bad things or that are living in bad enough situations that make them do those things (hey, until we're in those situations ourselves, we don't really know what we'd actually do, best intentions not to or not!) and all I can do is to try as best as I can to avoid those people amd situations altogether. There's not much more to it and I don't need to imagine a devil or some other stuff to explain this somehow.