IIRC Undertaking isn't illegal per se (lanes moving faster than other lanes etc). However it can land you in trouble with charges of dangerous driving.
I would argue if pulled over that the driver in the wrong lane is driving without due care and attention. And that it is not a dangerous manoeuvre to undertake them at speed as the hard shoulder is a viable escape route, and crossing two lanes of traffic to move into the fast lane would be more dangerous (in certain circumstances).
The danger is that if you undertake someone (and the person your are undertaking is sitting in the middle lane) you can't rely on them to check their mirror, as if they decide to move over to the inside lane (without them checking the mirrors or blind spot) they are going to hit the side of your car at the moment you are under taking them


