Nested Submodels

You can create submodels inside models:

with pm.Model() as m:
  with pm.Model() as sub_m1:
    ...
  with pm.Model() as sub_m2:
    ...

All the variables in sub_m* will be added to m. Does that achieve what you wanted?