Hanuman is Chiranjeevi – one who lives forever. Thus even as various eras passed by Hanuman were ever-present. He was also told that Lord Sriram would reappear as Lord Krishna at a future time. Thus Hanuman appears in the Mahabharata at two junctures – once to quell the pride of Bheema and the second time to see Lord Krishna.
Hanumanji’s flag signifies sense control and mind control that gives victory to the higher nature over the lower nature.