Isn't it necessary for you to implement something similar to the compat master scheme? I.e. not only have separate compilation handlers, but also separate master objects?
Looks like the compat master scheme uses subtyped object pointers, i.e. Pike_N_M_master::xxx, which I doubt would work for you, but you could instead have a global mapping somewhere where you keep track of the master objects for your "tenants".
Note also that some caches in the real master should be possible to keep global. E.g. fc, because it uses paths, and the objects mapping, because it's indexed on the program instances which are different when there is a real difference. The programs mapping also uses paths, but a problem there is the special "/master" entry, so it'd require some sort of wrapper object with `[], `[]= etc.