no, it isn't illegal because you give it protection after it gets
hit.
Anyway this tactic is not to make it untargettable but instead to nullify
your opponents cards, so it is perfectly legal.
_________________________________________________________________