A very likely source would could possibly be from another part of the Bible;
Proverbs 10:13 - Wisdom is found on the lips of the discerning, but a rod is for the back of him who lacks judgment.
So making a rod for your own back would be another way of saying that you may have shown bad judgement and will be in need of a rod