Not pulling over immediately
In Baton Rouge, Louisiana there was a black man posing as a policeman. This was in the late 90's. He would pull over young white college girls in their cars in UNLIT areas. He would then kidnap them, rape them and kill them. I think he had at least a dozen murders before he was finally caught.
NO, you do not have to pull over immediately when the blue lights go on. From what you said, though, you were on a dark road that goes on for a long time. There was no well lit area for you to go to. I know you probably weren't thinking clearly on the spot, but you should have pulled over, cracked your window an inch and asked the officer to please follow you to a more well-lit area - did he have a place in mind that you could go? If he refuses to move the incident, then you should clearly explain why you are afraid in this dark area - could he please provide some credentials.
However, in most instances now, police do not even approach your driver's door. They might even ask you (from their vehicle) to get out the car and approach them at their headlights. If he really is a rapist, then your life is in mortal danger. I honestly don't know what to do in that situation - maybe open your window and yell out the car "I don't feel safe being pulled over here, can we move to another area" - preferably with bright lights and a camera. GET AN ATTORNEY. WORK OUT A PAYMENT PLAN.