I call this feeling "The Holy Spirit" and no I'm not religious, hear me out.
So there's "The Father" which is you, in charge of everything.
Then there's "The Son" which is your Jesus, the bit of you that does shit mostly perfectly without any input from you. The scary example of this is when you drive to work and can't remember the drive at all. Jesus Take the wheel. Teach your Jesus right and you can trust he'll do things fine.
Then The Holy Spirit, which is that part of you that sees everything, before the filters are applied, and let's you know something is off. There's no obvious reason for it, but there's something off about this guy and we need to get away from him as soon as possible and never interact with them again.
The Jesus part is the important bit for most of us. Learning to play the guitar? Teach your Jesus. When you've practiced enough you can just trust that Jesus will hit the notes while you concentrate on singing along.
When I learned to Juggle I just taught my Jesus how to throw properly so it lands in the other hand.
At work I teach my Jesus how to do the manual labour, do the checks I need to do, and I can concentrate on ripping on my work colleagues.
Illness, death, and antisocial behavior. All of these were threats we evolved to handle, people who are "a little bit off" in one way or another, who might endanger the group or individual. This, and that our pattern seeking brains don't like it when something doesn't easily fit within an existing schema, even more so if it lies just outside of our existing preconceptions.
Obviously, I can't say that these definitely are the reasons why we experience the uncanny valley, but I think it's probably a better explanation than... Skin walkers? Or whatever else the meme would be implying.
Still, it's a cool premise for a horror story at least.
Back 4 million years the whole world really was a planet of the apes. So in some ways recognising something that wasn't your species, but looked like it might have avoided conflict, loss of territory, loss of food..
"But in general, take my advice, when you meet anything that's going to be Human and isn't yet, or used to be Human once and isn't now, or ought to be Human and isn't, you keep your eyes on it and feel for your hatchet."
You would think so, right? But funnily enough, whenever we find a new type of hominid that existed around us (neanderthals, denisovans, homo florensiensis), we find out that humans interbred with them and they are a part of our modern human DNA.
I bet humans learned to "other" things that look like humans so they could do things like avoid the sick and dead, dehuminize other tribes to kill them in war. All the very human things we do now.
It would be a evolutionary benefit to fear / avoid any person that is behaving strangely in certain distinct ways. Could be a dangerous transmittable disease, i.e. rabies etc.