What's it called when an inventor's invention backfires on them?

https://midwest.social/post/11935785

What's it called when an inventor's invention backfires on them? - midwest.social

Is there a name for this specific concept? Where somebody invents something (to do them good) but then that thing turns around and backfires on them?

I don’t know of a single word. How about some phrases?

Choked on your dinner. Shoot yourself in the foot. Cut off your nose to spite your face. Dig your own grave. Sign your own death warrant.

Step on your own dick.