[engine][VELOCITY-915] Add new backward compatibility flags to mimic 1.7 behavior for invalid references event handlers