You have a good point re roof penetrations. There are too many cowboy solar installers casually drilling holes thinking a blob of silicon is enough to seal out the rain. Also, when you eventually want to replace the roof handling and reinstalling the panel probably doubles the labour costs.
This was a reason I put solar in after installing a standing seam metal roof. The roof will last 50+ years, and the solar just clamps onto the seams. Only penetration is for the cables to the inverter.
My thought is that you would install the solar panels when you're replacing the roof. Put 30 year panels on a 30 year roof. 30 years later you get to do it all over again, but at least you're not removing and reinstalling the panels when you replace the roof.
Even without solar, few last 30 years without major repairs where I am (pacific northwest). There are lots of things to consider. Some/most solar installs don't take debris into account, creating dams that can send water places it shouldn't be, like up and under shingles. Not an issue in the desert but in rain forest it is a big deal. And the number of penetrations ... I've seen people put dozens of screws through what used to be a good roof. They cannot all be perfect.
Around here (midwest) hail or wind usually knocks out composite roofing in 10-15 years—much less if you're unlucky. There's little point in springing for the "50 year" composites and similar.
I guess the solar panels would protect the roof a bit, but I'd expect a bad hail storm to be bad news for those, too.