Its interesting, but sill the best option is to give the Engineer some Kind of AI if they get hit to run away automatically or when they see the enemy at a certain radius will move back to the original location.
That needs to be togglable since the vast majority of the times when a fight is happening, i want my engineers to continue building defensive structures regardless of being hit.
As towards the original question, i believe the best option is the military units take priority during selection, with engineers being ignored. Took me a full game to understand why my engineers were not responding to my new orders, and whilst pressing stop does not take much, its not particularly intuitive either.