The basic idea is to split reading of XML definition and resolution of layer IDs into layers. Also includes some cleanups in QgsProject and improvements in QgsVectorLayerJoinInfo.