Monsters that are aggressive to you do not engage in fights when you have a level up message active.
So if you get a level up mid combat it is okay but if you level up with the last hit on a mob it will cause others to not attack you.
I could be wrong but isn't this something recent that Jagex put? I don't recall it happening on pre eoc but again I could be wrong.