The code speaks on how it is illegal and how you can get a ticket. The police do have the right to pull you over to give you a warning. He did not give you a ticket for the light, just a warning. They still have the right to ask for your ID when being pulled over about a warning.
If the top light was not there at all, then he would of never had the right to pull you over.
It is safer for cops to pull over drivers and give warnings about brake lights being out. It would of been better for you to receive the warning if your ID was not suspended. Imagine your ID was not suspended, if he never warned you, then a second one went out, then you received a ticket. You would of wished he would of warned you the first time.
So remember, the code stands for stopping the ticket, not stopping a warning.

