Wiktionary
dig one's own grave
vb. (context idiomatic English) To behave in a way that is likely to have future negative effects on oneself.