Measures like these have emerged in a number of states out of a wellspring of conservative panic about the country’s abrupt legal and cultural evolution into a society that’s broadly tolerant of gay people.