Judging where to be in that road layout is always tough, especially in the wet, and dark, and where everything is moving.
Far enough into the lane to absolutely prevent some nerk in a car trying to overtake means anyone on a powered two wheeler can get through the gap, but (as here) will be too close for comfort (and as he tried, they might even go for the undertake). Far enough over to the left that a PTW can get through safely means leaving enough room for a car driver to chance it. No easy answer, and every turn of the pedals means the situation has changed again.
Even if you are alert enough to realise there's a PTW there, and you make room for them by going slightly left, that move might be misinterpreted by a car driver as an invitation to overtake right behind the PTW, and that's not good. And you've got to be keeping your eyes front, and it's wet, etc etc. I'd place myself exactly where you did, slap bang in primary.
He was too close without a doubt.