The saying came from the story of Sang Yang (390 BC – 338 BC) during the Warring States period.
Sang came from a noble family from the state of Wei, and was studying under the Prime minister’s house. The Prime minister of Wei was growing old and when he was about to die, he told the king of Wei “Yang is the brightest man I’ve ever known, either let Sang Yang take charge after I die, or kill him before he goes to work for another state”.
The king of Wei thought the prime minister was close to dying and delusional and didn’t take his advice. Sang left Wei to search for better opportunities and arrived at the state of Qin where he became the prime minister.
Sang was a strong beliver of absolute and strict law and punishment. He put forth a series of judicial reforms that boarded extremes. One of such new laws is if you harbor a fugitive, whether you know that the person was a fugitive or not, your all family will be killed.
Sang’s strict laws goes as far as punishing the prince’s teachers by cutting off their noses for a crime that the prince committed.
It was of course just Sang’s luck that when the old king of Qin died, that prince became the new king. The teachers that had their noses sliced off accused Sang of treason.
Sang had to flee the capital and when the soldiers caught up with him, he begged people for letting him hide. People being afraid of having their families killed for harboring fugitive refused.
And there came the saying “Making a law to tie up oneself”.
Sang was killed having 5 horses tied to his head and limbs and torn apart by 5 chariots, and everyone of his family killed as well. All of which are his own laws. Interestingly, before he died, Sang led Qin to defeat the state of Wei, making the king of Wei crying with the words “I should have listened to my prime minister”. And after he died, his laws and national strategy made Qin the strongest state, and eventually Qin conquered all other states and became the first chinese empire.