It's not the case that posts containing "thanks" are deleted. But "thanks" doesn't add to the useful content on the site, so posts that consist only of thanks are deleted because they don't contain useful content. This often happens on questions that attract new users, who post an answer thanking the author of another answer, the same way they might on a web forum or mailing list. Such answers should be flagged as "not an answer" if they don't answer the question, and they'll end up deleted via the "low quality posts" review queue.
Separately, some users write questions as if the question were an email to the mailing list: they include "thanks in advance, Dan" (or whatever their name is) on the bottom the way you would sign-off an email. Again, this is unnecessary on Stack Exchange sites. Your username and profile already show up at the bottom of every question, so this just adds noise. It's not recommended to edit a post just to remove a sign-off, because edits should be substantial and improve multiple issues in the post, but if people are editing anyway, it's commonplace to remove superfluous parts that don't relate to the question. That includes "thanks in advance" as well as common phrases like "help plz" or "urgent help needed".
Stack Exchange sites have a formalised, accepted way of thanking other users for their contributions: upvote helpful questions and answers, and accept the best answer to your question. This allows everyone on the site (who's been here long enough to understand the rules) to thank people without filling every question with hundreds of "thanks" comments. It also means we can count those thanks towards each user's reputation, to make it easier to see which users consistently make helpful additions to the site.
For the particular example you've added to your answer, it sounds like whoever dealt with your flag didn't understand what you were saying, and thought your complaint was that the questioner didn't accept your answer. Be extra clear when raising flags in future.