Logic is not independent of emotion. Some people with damaged amygdalas can reason but can't weight any fact as more important than another.
Dale Carnegie taught that if you had a relationship with people, you would be better at reasoning in ways that benefited them and they would also reason in your favor.
Given the same facts, we still weight the importance of those facts from unimportant to highly important. It's possible that the legislators were corrupt and passed laws they knew to be unconstitutional and more likely that they had desire to pass the laws so they weighted the likelihood the laws were unconstitutional as low.
However, as a Twain said, it's hard to reason with someone when their salary is on the line. Major farming states means lots of farmers means votes, power, and future donations flow from pleasing farmers. The legislators are unduly influenced by these facts and make obviously unwise, dumb, unconstitutional decisions.