To be fair, it was both. If you look at contemporary writing among lay Americans, they earnestly thought it made Mexicans crazed and dangerous. It's good to look at history through economic and political lenses because that's often the steering wheel or gate control, but (in approximate-democracies) it's also good to acknowledge what everyday sentiment was among lay citizens.
A country can be calculating and moralizing/prude at the same time, and America's biggest historical moments almost always hinge on getting those two things to align. Even today.