I know you said "new" master cylinder, but as far as I know A1 Cardone does not produce new master cylinders for our trucks, just rebuild parts. The reason I point this out is I have had next to no luck with rebuilt master cylinders. Of the half dozen or so I have tried early in my wrenching days, more than half have done exactly as you describe out of the box.
There are only two ways a master cylinder can bypass fluid internally, either the seal on the piston is damaged, or there is a flaw in the bore of the master cylinder itself (wear, groove, gouge, etc). If it is a damaged seal, it would bypass fluid no matter where the piston of the MC is in its bore. But if there were damage to the bore, it would only bypass fluid when the piston is in than spot. When you capped the outlets, the pistons cannot move. So there is likely no damage to the seals. But when you have the brake system hooked up, the piston in the MC moves in to its bore to the spot where there is damage and the MC bypasses fluid.
Years ago I chased my tail trying to figure out exactly what you are experiencing. The symptoms pointed to a bad master cylinder, but I "knew" it was good because it was the first thing I replaced. I was wrong, the master cylinder was bad out of the box, and when I finally made up my mind that was the problem, the replacement fixed it immediately.