The crucifixion had nothing to do with being obedient to the Law.
There's no commandment that says a person must be crucified.
He was obedient to the Fathers plan of The Lord being the Passover Lamb and the Sin Offering through His Crucifixion.
He was being obedient to the law to love YAH above all else. For YAH so loved the world, that He gave His only begotten Son, that whosoever believeth in Him should not perish, but have everlasting life. He was being obedient to loving His neighbor as Himself by giving His life to save His neighbors who could not save themselves.
Matthew 22:35-40
35 One of them, a Torah scholar, asked Him a question, testing Him. 36 “Rabbi, which is the greatest commandment in the law?”
37 Yahshua said to him, “ ‘You shall love the Lord your God with all your heart, with all your soul, and with all your mind.’ 38 This is the first and great commandment. 39 A second likewise is this, ‘You shall love your neighbor as yourself.’ 40 The whole Torah and the Prophets depend on these two commandments.”
He was being obedient to the greatest commandments which required Him to give His life to save us in obedience to the Father Who so loved the world that He gave His only Son and loving His neighbors who could not save themselves.