One law protects people from civil liability and damages. Protection from civil liability would only apply if the person also calls the police or 9-1-1 and believes leaving the child or animal in the vehicle would lead to injury or death.
The law does not protect people who recklessly break into vehicles or do more damage than is necessary to save the child or animal.