That's wrong. Moat and Lighthouse say "when another player plays an Attack card", i.e. they care only about the moment the Attack is played and not about what the card actually says.
You could e.g. have a Duration Attack that says "in 5 turns, all players get 5 Curses" and while it would be a mess to track Moat would only be able to defend against it if it were revealed at the very moment the Attack card is played.
But when something appears below a line on a Dominion card, it doesn't happen when the card is played. It's just saying that e.g. a general rule of Dominion is that while a Highway is in play, cards cost $1 less. My gut says if you revealed a Moat when a "while in play" attack is played (assuming the "while in play" is below a line), the "attack" would not be blocked, because you're blocking the effects of the card itself, not the rules of Dominion.
Regardless of whether that interpretation is correct, the more important point is that it's very unclear what would happen in that case, so probably best to avoid that situation altogether.