In the presence of largesse, there are often accomplished mental convolutions, just to avoid thanking anyone. We seem to have an inherent need to give thanks, not only to other humans, but to something or someone larger. But after modernity, no God is available. So…thank impersonal objects?
A common trope of the mind determined no to know divinity, is “wonder and awe at the mystery of the universe”. This is hard to sustain. It requires vigilance to suppress the instincts.
Because the typical person, like you and I, will actually thank people. Not the sun, the microbes, or the ancient dead primate precursors. Caught off guard, not thinking about thanking, but actually thanking, and in the absence of an alert internal editor to tailor the spontaneity to fit his mental worldview, we function as designed. The “thanker”, unleashed, thanks people.
For the materialist, the urge to give thanks to something greater than your friends or your mom has no known function. It is vestigial, like the appendix, but vestigial of some yet to be identified function.
Another explanation: it is vestigial of the Person who made us. A personal effect of a personal cause.