According to the Merriam-Webster dictionary, the age-old phrase “Hoisted on your own petard” dates back to William Shakespeare’s Hamlet (emphasis mine);
This oft-heard phrase owes its popularity to William Shakespeare’s Hamlet in which the titular character says, “For ’tis the sport to have the engineer hoist with his own petar[d].” (A petard is a medieval explosive. The quote implies that the engineer—the person who sets the explosive device—is blown into the air [hoisted] by the explosion of his own device.)