辛苦 in itself means
'to toil, to work hard'
辛苦了 does not translate as
"Thank you for working hard for me!", it does not necessarily express gratitude for something that directly benefits the speaker.
Consider e.g. the following: a friend of yours who studies abroad returns home to your village and you meet him at the station, you can greet them with
路上辛苦了吧！ This could mean
"That must have been an exhausting journey!", it doesn't mean "Thank you for taking this hard journey to see me." Or you could translate this as "You've come a long way."
Another situation, you visit some relatives and they ask you about your job. You tell them all kinds of things you do at work, you do your own tasks, you write report for your boss, you take phone calls, you supervise other people's work, you do this, you do that, etc. Your relatives could praise you with 你工作太辛苦了！ "You are working so hard!", just to praise your merits as a hard-working person. Your work will probably not benefit them at all, nevertheless, they praise your work ethic.
Third situation. You see your neighbors being busy in their garden, you ask them:
"Wow, what are you so busy with?". Your neighbors work won't benefit you too much, but you can be polite and show them that you admire their diligent nature.
Of course, if the situation makes it clear, that the speaker is benefited by the other person's work, the phrase can have a direct reference to this. E.g. a friend shows you around in their hometown, you can thank them:
"You must be tired for taking me around, thank you!"