I would be very grateful if you could let me know whether the term 'flank' is informal, or whether it would be ok to put it in an essay or formal document. Eg. Person x was flanked by a corrupted mentor.
It's not colloquial or informal; therefore, it could be used in a formal essay.
However, I find your proposed sentence rather puzzling. I am afraid that you might misunderstand the meaning of "flank" or be using it improperly. Can you write your sentence in other words, even if it requires a lot more.