As an extension of てくれる
, which expresses that something was done for the speaker, or someone within their immediate circle, てくれてありがとう
thanks someone for that action.
Thank you for always catching the cockroaches.
Thank you for buying the cake for me!
This expression is usually reserved for actions that clearly benefit the speaker. It would not sound natural when thanking someone for something that they are expected to do as part of their job, or due to simple etiquette.
Thank you for putting my bento in a bag! (Slightly unnatural Japanese, if just plainly thanking someone for doing their job)