I read it as "it" being the situation. e.g., "was it a child who painted this?"
it isn't bad grammar, though you could argue it's poor writing because it's confusing. it's using a feature of english called it-extraposition. some examples here: https://www1.icsi.berkeley.edu/~kay/bcg/extrap.html
basically, it-xp lets you delay a constituent in certain circumstances using "it". sometimes this is required to make a sentence grammatical.
"(What to do next) is not clear"
"It is not clear (what to do next)"
*"Was (who painted this) a child?"
"Was it a child (who painted this)?"
We can combine this feature with clefting the end of the sentence to make something that seems to refer to a person by "it", but actually refers to an elided constituent: Discourse: "I don't know the gender of the writer"
R1: *"Was (who wrote this) a man?" (can't have wh-phrase here, needs it-xp)
R2: "Was it a man (who wrote this)?" (OK, but the last part is redundant. Discourse already includes we are talking about a writer. Grice's maxims suggest we will usually drop it.)
R3: "Was it a man?" (looks weird, but sounds perfectly normal in context)
I'm a linguist / syntactician by training, but also nonbinary and use they/them, so I have some skin in this game. I think the GP was being obtuse, maybe purposely, but not malicious.