We've all had drivers approach fast from behind, but we get to choose how we act, even if they are tailgating. It was midnight, so I'm sure it wasn't an endless line of bumper to bumper cars that were blocking you. Thinking there are only 2 options is defaulting to the sucker's choice.
All other elements of story, from him tailing you quickly to see how fast you would go (nice that you got that on dashcam) to the officer no showing in court twice to the judge's two different standards comment and ruling, all stink big time.
Could you report that behavior to the police station? I wonder if that is common practice and wonder what that officer's supervisor would think of that. That said... You don't want the refiling the case!
Well done on the personal defense!