I have observed your requirement and sample code used on your end. I regret to share that in present data structure of TextFrame class the link to parent shape is not available. Therefore, you cannot directly jump from a TextFrame to its respective Shape that you may use to remove it. I have created an issue with ID SLIDESNET-37199 in our issue tracking system to investigate the possibility of adding the parent shape reference inside TextFrame class to support the back tracking.
In order to fulfill your requirements, I suggest you to please traverse through every slide and its respective shape collection. Then for every shape inside slide, you check its text frame for your condition matching and removing the desired shape if the condition matches. I hope this approach will be helpful in your approach and is not a big transition as well.