While you’re correct that laws are created by the legislature the judiciary is where they are judged to be just. At least in systems based on English common law. Look up jury nullification for more info. Also, prosecutorial discretion is a thing. Basically if any law isn’t enforced either through jury nullification and/or prosecutorial discretion then it is vestigial and should be amended or repealed.