your second sentence seems entirely unrelated to your first
As opposed to conseqentialism, in this view, if the laws are made in accordance with agreed and lawful procedure, they are just.
Most people skew towards consequentialism, but not all.
1. https://pediaa.com/what-is-the-difference-between-deontology...
This isn't exclusive to laws though anyhow. If you believe morality can be better tomorrow than today then you have to accept either being immoral today or only relatively moral to your own time.