Consider the legal defense called criminally insane. The concept of criminally insane is something we infer from outward behavior, but can't pin down externally as a thing like a rock or tree. It is based on how the unconscious mind/brain interacts and influences the conscious mind. The conscious output behavior allows us to infer this concept of criminally insane. It is an abstraction to explain behavior that borders on way out there.
The concept of the devil works the same way. It is not outside like a rock or tree or an animal walking around, which you can observe, but rather one infers it from human output behavior. Criminally insane has certain parameters, which we add to, as new circumstances and legal trials occur. The Devil inside also has certain observational parameters which are added to, as new circumstances occur. The church had a list of inferences based on human behavior.
There is a logical reason for the devil inside and its influence on behavior from which is can be inferred. It is based on knowledge of good and evil. Any law which differentiates good-evil behavior is a type of binary data in the sense within the law are both the evil and the good directions at the same time, so people can avoid one behavior and do the other. For example, killing is evil. This also implies, not killing is good. Both are implied in the same law.
When the brain engrains memory it makes use of the limbic system which adds an emotional tag to the memory. This is why the strongest memories have a strong emotional valance. Even senile people often remember their childhood since this is when emotion is strong and memory engraining strong. Relative to the binary laws of good and evil, the good side of the law gets a positive emotional valance (peace, love security, etc.) while the negative side gets a different emotional valence (fear, rage, pain, etc.).
The brain stores memory in layers based on emotional valence, with each law of good and evil stored in two separate layers. One layers has all the good or positive sides of laws. This is reflected in religious symbols like heaven where it is populated by all the good behavior, full of peace and love. The other or the evil fear/rage layer has all the negative sides of the same laws. This is reflected in symbols like hell where there is all the violators of law, plus emotions of fear, pain, rage, etc.
The devil inside is connected to personality firmware that evolved within humans, which makes use of the fear layer of law as its matrix of expression. It only exists because of law of good and evil and the way the brain will segregate the binary law via like emotional association . Without the tree of good and evil (philosophical systems of morality), there is less segregation of memory and the lower the influence of the devil. Some cultures don't create this polarization, but once created, it does create an internal polarization between conscious and unconscious.
The devil inside is inferred from behavior which use the negative matrix, which in turn is maintain, by law of good and evil. If we change laws of good and evil, we reduce the polarization and also reduce the devil inside.