This is going to be a short post, but I hope that it stimulates thought and maybe some conversation in the comments section.
I would say that ALL laws (laws that restrict your liberties) are created because of selfishness. They are either created because of the selfishness of the law giver, or because of the selfishness of someone that then required the law. Laws are created to protect the majority from the selfish minority.
Just imagine what type of world this would be if everyone just dropped being selfish and look at the ways their actions effect others.
Laws/Ordinances restrict and remove liberties, and would not be necessary if everyone worked on being less selfish.