Re #7216. Ensure non-const ref is obtained before const one.

As it may trigger a copy inside the cow_ptr and invalidate a previously
obtained reference if the input & output workspaces are the same.
In reality, Y & E vectors are almost never shared (outside of tests),
but it's better to be fully safe/correct.
Merge remote-tracking branch 'origin/feature/7234_nomalisetomonitor_race_condition'