You could make the same argument that As a software engineer, you have to be able to identify and write high quality software to be effective at your job. So should your employer fire you for writing this code outside of your regular job duties?
What about if a friend shows you their code, and you say "that looks good" but it turns out that this code is vulnerable to a key security issue? Should you get fired from your security job?
I think we'd agree not, and more broadly, that making a statement or doing a task related to your job but outside of your job's responsibilities should not be sufficient to fire you from your job. Especially when it's clear you are not representing your employer, by using pseudonym.