Seems to happen to all brands, some worse than others. I am thinking they are using thinner glass than what's used for the windshield. But other factors are likely added to the reason.
1 - If the glass is installed in a frame that is slightly too small, as the glass expands due to heat, the stress of the frame on the glass = shatters.
2 - Sun Roof glass is very dark, usually the darkest glass compared to everything else on a car. Dark glass expands and contracts more than light colored glass.
3 - The sunshade cover between the window and the cabin = traps more heat. Thus, the glass is even hotter than normal. Moving that sunshade can cause a quick change in temperature for that window which results in it shattering. (One of my favorite cups shattered because I washed it out with hot water, then put a cold drink and ice cubs in it without thinking. I picked up the cup with my hand, the bottom half broke away - ugh. Not replaceable)
4 - Hyundai seems to be rated as having more issues than other brands. Again, thinner glass could be the cause.
This makes me nervous, as certain trims of cars comes with a sun roof, even if you don't want one. This makes me want one even less, stick with a lower trim.