You must be new to London traffic. Legal or not, that sort of move is a normal occurrence in London, and if you are betting your safety by relying on other drivers / riders's obedience to the highway code, you may run out of luck at some point. I don't think there is a single journey into London, not even on a Sunday morning, when someone doesn't cut me off, pushes me to a side or slows me down. Cycle lanes are not respected, neither are solid white lines, chevroned areas or speed limits. And cyclist are amongst the worst offenders that I constantly have to dodge and avoid knocking them down for my own sake. It's a bit of a jungle and quite dangerous place to be a cyclist.
The only way to increase you safety is to ride defensively and be aware of you limitations. Apart from being visible, alert and aware of traffic around you, you should be expecting this kind of move and be prepared for it. I didn't know when the cab driver was going to undertake you by watching the clip but I anticipated the moment by a few good seconds when I noticed the gap developing. It was large enough for a car to squeeze through and it did. Regardless of your fitness level, no driver will be happy to cruise at 15mph behind a cyclist so they will try to over / undertake you, especially in central London. It doesn't matter who was wrong or right when you end up in the hospital or worse.
Confrontation it's always a bad choice. The odds are against you as a cyclist vs. any other vehicle. If it were to end badly, it's easy to guess who would suffer more.