How can a commentary be published before the commentary it’s commenting on?
Assuming your "commentary" was not publicly available (e.g., as preprint on your homepage or some server), and assuming that you submitted it to the journal under an assumption of confidentiality (in the first place), a reasonable editor and/or referee would certainly not publish commentary on a thing they had under confidential review... IF "commentary" means something at all conforming to the usual rules-of-the-game with "papers", which I can't quite tell from the sketchy details you've given.

That is, in the world (academic mathematics) in which I operate, if in the course of refereeing papers submitted to traditional journals I learn something interesting/useful, or disagree with various aspects, my main channel of response is (anonymously) back to the authors through the editor, requesting or recommending a revision. It would be highly inappropriate for me to write and make-public, whether on a web site or any other venue, a paper either extending or contradicting or critiquing that paper prior to its official public appearance.

If anything like that has happened, then it does seem well outside the bounds of propriety, yes.