I have been a (pro-tem) moderator on cs.SE since the beginning, so I never had much of an opportunity to issue flags without mod powers behind them (which means they are automatically considered helpful). Yesterday, in the few seconds between the end of our first elections (during which I was reelected), I got awarded both the Deputy and Marshall badge.
I issued lots of flags during my time as moderator: mostly "obsolete" flags on comments, for the purpose of leaving a paper trail.
There are two conceiveable options here: either such flags -- cast as a moderator and therefore self-approved -- count towards said badges, or they do not. In the first case, I should have gotten the badges the moment I cast the last necessary flag¹ (which didn't happen). In the second case, I should never get the badges, at least until I stop being a moderator and issue the required numbers of flags which a moderator then deems helpful (which is also not what did happen).
I can not explain why I would get the badges during a brief period of not being a moderator, so my conclusion is that this is a bug.
By the way, the only definitive statement I could find here on Meta is
The Deputy and Marshal badges are only granted to registered users - not moderators.
This does not really say whether flags cast as mod should count later, but I think the implied spirit is that they should not.
- Or when the badge-awarding cronjob runs next, which should be at least once a day.