Other professions are self regulating, if you do unethical things your peers (the AMA or legal boards) will strip you of your license to practice and then you can’t find a job.
It would be too much to expect engineers to somehow be angels without the threat of punishment when even doctors need these systems.
But on the other hand, imagine if you heard about this agile thing but you can’t legally apply it because waterfall is mandated and if you apply agile you might be stripped of your license to practice software engineering.