Mod have access only to unit data and result is cached (sometimes my mod will be bit buged if some unit property is changed and cache not refreshed). Because of this its impossible without code change. A lot of simpler would be ignore my mod and hardcode flashing into game, that will be easier and faster.
BTW I think better will be if affected unit will not turn red but became brighter in colors.