You must live in California, because that looks to be exactly the case as it stands here with one addition. Police gain protections and immunities both in state law and in federal law.
However what you described is only what is on paper and leaves out the many unwritten laws. Such as that the police, being above the law, get to decide when the law is enforced and may always claim a misinterpretation of the law to justify what would otherwise be criminal acts.
My favorite example of this is the HB police officer who was stalking a coke using stripper and eventually stalked her leaving her work, pulled her over, blew his load on her face and sweater and then left. Despite the DA prosecuting him proving that he had ran her plates through CLETS 30 minutes prior to her leaving her work and his pulling her over, and despite catching him in several perjuring statements in court, the judge and jury some how ruled that because she was a stripper, she was a professional at using her body to manipulate men, and that she had some how manipulated the officer into the circumstances to get out of the traffic incident.
Of course, then there is the case in San Diego where they mobilized the swat team to apprehend a teenager over a stolen PS3 and when they went to arrest him at his parents house opened up with their automatic weapons through a frosted glass door because the kid "had a weapon" when he was holding the PS3 controller...
Or then there is the guy who is serving time in jail for shooting a cop when the police were serving a no-knock warrant on a criminal who had left the apartment complex 6 months prior, and whose apartment was on the other side of the complex. The police broke into his apartment, never announced who they were and the guy reacted what any rational person would do, he immediately grabbed a handgun and went to his infant babies room and shot at the first armed attacker that came after him.
Or how about the mayor who uses a separate last name from his wife who received a random shipment of drugs. And despite the FBI, DEA and the state police knowing that it was just a blind ship and that the criminals often snatch it from the porch before the home owners get the package, the local police, decide to do a dynamic entry on the mayor. Breaking in and killing their two dogs (who were fleeing the cops) and arresting the mayor and his wife for drug trafficking...
Well, I can go on and on, but the facts remain that the police can basically do whatever the hell they want regardless of what some mere paper says their authority is restricted to.