Exodus 23:22
If you indeed obey His voice and do all that I speak, then I will be an enemy to your enemies and an adversary to your adversaries.
Obeying with God is meant to keep us out of trouble and not to be a punishment. God only wants the best for His people and His ways and thoughts are higher than ours. Which means God can see and understand things that we can’t see or understand. The world operates under laws that God established, so isn’t it better to have the writer of the laws on your side than the lawbreaker?