This idea would only work if either the planet's moon was right in front of it from out point of view, just going behind it or just coming out from behind.
Well...yes, and no. I'll start with the no: The idea is that if the planet and moon are both in front of the star at the same time, no matter how they're aligned, the spectrum will look like it's being filtered through their combined atmospheres. They're just so far away that everything blurs together.
But it does seem like there should be ways to tease them apart. If the planet and moon are widely separated, there should be a brief period when only one atmosphere is filtered at the beginning of the transit and again at the end. This may be too brief for current technology to detect. It could also be mistaken if the planet is really a single planet that is somehow highly asymmetrical. (Perhaps something evaporates by day and condenses by night?)
The other thing that comes to mind is that a moon orbiting a planet will likely have to move fast. Astronomers are good at calculating speeds, especially relative speeds, with redshifts. They've measured the very slow motion of stars as large planets orbit them. So if they detect that the signatures of the two gases have significantly different redshifts, they can conclude that one gas is on a planet while another is on a moon. This doesn't eliminate all false positives - the planet and moon could be close together, and thus not moving much toward or away from Earth, when the transit happens. But multiple transits are likely to have different alignments, unless either the moon's orbital period is synchronized to the planet's, or the planet and moon orbit in a plane perpendicular to our line of sight. Both of these are not impossible, but are unlikely. An asymmetrical planet with a high rotational velocity could also produce a false negative, but this is also unlikely.