This is a discussion I have in my ethics classes. I like to use Kohlberg's Model of moral development (one of many options) as the framework for the discussion.
https://en.wikipedia.org/wiki/Lawrence_Kohlberg%27s_stages_of_moral_development
Under than model, all too many people (upwards of 40% in one study) get stuck at level 4, which means they see the law as the moral system. Dangerous thinking that's often how bullies, political evils, and Authoritarians gain power over the public. Once they can control the laws, those people will just follow along because they can't even envision how challenging the law for humanity's well-being is even possible.