This reminds me of Capgras delusion. To (over)simplify, patients lost the ability to identify people they knew, while retaining the ability to recognize that person’s features as those of the person they knew. So they could tell that person X looked and sounded exactly like their husband/mother/etc, but “knew” that it wasn’t that person, usually because of underlying schizophrenia or brain damage. Consequently, their mind filled in the gap with the only remaining possibility: that the person/thing that looks like person X is an imposter.
Basically, the exact same mental systems responsible for filling in the gaps in our perceptions and memories generally help a person with healthy mind function better, but in a person with an unhealthy mind provide an outlet for the disease to manifest to the consciousness.