Nothing mysterious here. You simply mucked up that track matte thing. You cannot set all layers to use your top layers as a matte and hope it would magically work. This becomes unpredictable and uncontrollable as you just found out. Duplicate layers and assign individual mattes always immediately above the layer that needs to be masked. Other than that, if you are really looking for a top-down cookie cutter, Stencil Alpha blending mode on the topmost layer might be an option, but it will affect each and every layer below, including possibly a background you insert, so you are still facing some restructuring, duplication and pre-composing. In any case, it definitely wouldn't hurt if you read the online help. These are clearly the typical beginner errors of trying to do everything in one sweep with as few as possible layers, no offense.