Illegal to tell someone that they are speaking to undercover cops?

You can’t flash your lights to tell another driver that his lights aren’t on?

From the horse’s mouth (aka The HighWay Code).

Flashing headlights. Only flash your headlights to let other road users know that you are there. Do not flash your headlights to convey any other message or intimidate other road users.

I’m not an expert in California laws specifically and will not become an expert any time soon but it appears to fall under PC 148. In my state and in every state I’m aware of it is illegal to Obstruct the Administration of Law. What that entails is contained within the statute and case law and not arresting people because they are annoyed.