The original question mentioned 'Priority', and the answer is no-one has priority in those circumstances. Both drivers have an equal obligation to ensure that their actions aren't dangerous or careless.
If a collision occurred then the culpability is shared and the circumstances in which it happened will be examined also. For example, what was the differential in speed between the vehicles? What were the traffic conditions & density? etc etc.
In investigation terms, once the point of collision is known as a fact then tracing the vehicles back along a timeline will show where they both were when the first vehicle commenced the manoeuvre. Adding this into the larger picture of traffic conditions and what others saw plus any factual evidence from electronics or cameras (most motorways have cctv running) and a reconstruction can be made.
The question of degrees of culpability will be based on all of this but even after all this effort it may be that blame is shared equally.
In terms of 'undertaking', the good old Highway Code says that if traffic is moving in lanes and the lane on your right is moving slower than you, then you can pass on the left. It doesn't say anything about motorways in that.
It's simply a symptom of overcrowded roads.
The biggest & possibly hardest thing is to take the emotion out of driving incidents. Keep calm, think logically & don't over-react as it takes two to argue. You won't see them ever again after five minutes.