In some cases yes the motivation is to break it because it is a law but it is not universal. Not everyone does this or has such a motivation, some people might break certain laws because they are ridiculously restricting, such as speed limits.
A person could technically speed and not cause harm yet they are found to be guilty of a crime. These are victimless crimes and really do nothing but generate taxes for government. If the government really was concerned over safety they could easily place restrictions into car computers to prevent going over a certain speed on a certain road. But the law seems to be in place not to prevent tragedies but instead to make money so the law enforcement knows and even expects people to break it.
Other laws like, do not murder have a roll in providing a more secure or safe environment for people to conduct their lives. If your statement were true then people would want to murder solely on the premise that there is a law against it. This surely is not the case. People mostly kill for money or money related issues. Occasionally it is in self defense or out of some sort of hatred or anger but typically financial reasons. I would include accidents but we don't consider them premeditated or reactionary murder such as negligence. Anyways, I have never heard a guilty plea of, "Well I killed because there was a law against killing so I just wanted to break it, to break it."