Can anyone explain the origin and meaning of the phrase?
As you noted, your namesake is someone who was named after you. It comes from the phrase "for the sake of the name," i.e., for the purpose of or interest in having the same name. Let's take a look at your first online reference:
Chocolate Croissant: Where was the chocolate?? Chocolate was just for namesake purpose we guess.
This is from a review of menu item. From the absence of the key ingredient, it's clear his means that the restaurant used the word chocolate in the name Chocolate Croissant for naming (and thus enticing) purposes and not because any chocolate was used in the baking. But you're right that this stretches the meaning of namesake. The word chocolate is more of a modifier, and purpose is redundant with sake.
But that's how the language changes.
In British English it would simply be an error. I'll bet it's an error in American English as well.
Looking at those links, I see that several have grammatical errors. Apart from that I get the impression this may be an expression that is used in the English of India.
The nearest expressions that make sense to me are
'for nominal reasons'
'for purposes of expediency'
'and 'in name only'.
in name only
If a situation exists in name only, it is officially described that way, although that description is not completely accurate: Cambridge Dictionary Online
So the chocolate was chocolate in name only.