I’m not sure I understand exactly what you’re asking but that won’t stop me from suggesting a solution! Nest the composite and use it twice? Once below and then on top? Or invert your track matte and use that on the background footage on a layer higher up the stack?
I think I’ve had this problem before, but I’m not sure we’re talking about the same thing.