Some of those laws are more recent, I believe. I got CPR certified in the 90s and the police officer instructing the course did indeed warn us to be careful about saving people as we could possibly get sued.
If I had to guess, it was a symptom of the sue-everyone-for-everything craze in those days, crossed with state laws that didn’t yet provide explicit protections for good samaritans because you generally don’t try to harm someone who went out of their way to save your life.