What is the polite response to this nonsense? Are you still supposed to respond to recruiters who clearly didn't spend a minute reading your profile? Or do you just ignore them and don't respond at all?
Bit if you're just looking for validation from the internet to not be polite, then here you have it - it's ok if you don't respond to a recruiter who you don't want to respond to.
Spam does not deserve a polite response, and responding to spam is, in fact, detrimental to the rest of the Internet and rude to the rest of us using it.
So you are being rude when you do respond to spam - and including LinkedIn spam.
The companies that such people are attempting to recruit for, probably share my dislike for those that can't tell the difference between platforms or languages.