He wasn't a source, he was a subject.
Think of it this way: if the NYT was writing a story about Trump, is he a source they should protect? No, he's the subject: they might give him a chance to comment, but they're not going to let him dictate their coverage. A source would be (for instance) some White House staffer that gives an account of some non-public discussion Trump was part of, and who could expect reprisal for the act of giving that account.
IIRC, Metz learned Alexander's name independently of Alexander (not surprising because he linked it to his pseudonym himself), so Alexander was not the source and the NYT had no reasonable obligation to him to hide it.