[NB] update event detection (#12427)- fix detecting pre variables as conditions after swapping execution order of Events and DetectStates modules