Make sure gROOT is initialized before creating any TClass (that has a dictionary)

In particular this *necessary* for TObject and any of the classes involved in the ROOT PCM files.
This fixes ROOT-6787.