A police officer can pull your car over and detain you -- however briefly -- only with probable cause to believe that an offense has been committed and that you did it. There are a few exceptions, not relevant to your facts. By running your plate before he detained you, the police officer had probable cause to pull you over because of the info he learned when he ran your plate.
A police officer does not need any reason, much less probable cause, to run your plate as he did, without a prior detention. The law allows him to do just about anything to develop information if it does not cause a detention or other imposition on you.
An officer can run your plates at any time. Just in the same sense that an officer could always look at your face and compare it with a "WANTED" poster. I know you're in California, but I just today read a recent case from Oregon on this exact issue of being pulled over after a random license plate scan.
Like I said, it's an Oregon case so it's discussing Oregon law, but the basic analysis would be the same in California.
The police officer can run your plates. Regardless, you now have to deal with the suspended license, insurance matters- and other warrant. Which county is that warrant?
Call if you have questions.
Sorry, but yes - they can run your plate for no reason. They often do.
But I'm confused - was your license suspended or was your registration out of date?
If your insurance wasn't in force and your driver's license was suspended, they would have to take a two-step process: Run the car and find out who the registered owner is, then run the owner to see the license status. If it was suspended, how do they know the driver is the same person?
Can they run the plate? Yes. Can they run the owner? Yes. Was this a valid stop? Maybe, maybe not. The fine is quite large on a suspended license charge if you're convicted and it can be charged as a misdemeanor, so it's worth discussing this matter, including the validity of the stop, with an attorney.