The moderator in question (we shall leave him anonymous ;o) acted on the flag that was raised by the community, it was flaggingflagged as: not an answer.
Which in my opinion it indeed wasn't, the answer part was just "yes" and then came a comment. If your intention was to get the OP to respond, that's what a comment is for. With that action of converting your "answer" into a comment, you are still open to add a real answer. Plus at the time your "answer" was converted to a comment, the other answer was already there and it had already gotten votes, while yours didn't.
So the 0 votes plus the flag sounds like a clear indication of it not being an answer. Leaving it there would in my opinion send an incorrect message to the community (that it is okay to answer a question with another question or a low quality answer).
Perhaps the second answer given should have been an edit on your answer, adding the code sample there since you already answered it with a simple "Yes - of course you can.". But yeah if you can improve a poor answer and get nothing for it or add your own answer and get points for it...