Yeah sounds like he totally profiled you; happened to me all my life. And see sounds like you did have a honest cop behind you that saw it and cleared the matter up...now those are the good cops we need!
The moral of story here is to never go at the police alone in this situation...you lawyer up fast! Just getting a lawyer makes most of them back down because they know your rights have to be followed....believe me they will try to twist your rights. You notice how officers always try to be cool and get your consent; because the second you do you have waived your right. Same thing if they knock on your home door and they say "mind if we step in"...boom, you just waived your right and gave them consent to come in and search.
And I am not saying to not comply, but if rights are being ignored it does not always mean the cops are correct as cases get dismissed all the time for this reason. So as I said you have been lucky, but personally I had a cop say I ran from him on my sportbike the week before and me being calm and explaining it was not me did nothing for him. I know i was innocent, but he judged me guilty when he saw a bike that was similar to the one that ran from him (an black and silver F4I). Also seem cops personally plants drugs on people; that case got dismissed because he was pulled over for noise violation (loud stereo), but his lawyer proved that went into affect at 10pm and they pulled him over at 9:45pm.
Always best to comply, but don't let them fool you that you do not have rights. If anything you can get a case thrown out with a lawyer if they could not prove probable cause.
And not saying the "3 forms of id" is a law and she probably was mistaken, but I do believe it is a right to travel to a well light area since so many police officer impersonations have occurred. I just don't get why they didn't just pull out there badges when he asked...they did eventually to th wife I saw, but that was all he was asking for.