It takes surprisingly little water to contaminate the oil load. A cup of water will spoil the 5qts in an engine. Maybe a couple tablespoons of water will spoil the load in a tranny.
Only way I can think of for water to get inside is for aggressive pressure washing and the tranny vent up top.
We don’t know it was water, that was only a guess based on your description of a “marbled” appearance. That marbling means a fluid that is insoluble in tranny fluid and therefore prob not petroleum based… Transmissions get pretty hot so you’d think a little water would find it’s own way out the vent as vapor.
I don’t mean to suggest that the oil quality problem clearly resulted in the metal filings on the cap. Maybe it did and maybe it didn’t. It’s certainly possible to have 2 unrelated problems.