In the Story of Adam and Eve. God forbade them to eat from the Tree of Knowledge of Good and Evil.
They could separate Good from Evil already. Since they knew that eating the apple was evil. However they did not truly know evil. Since one could only know evil after eating the apple.
I think of Adam and Eve as wholly true in essence and matter (body). In this state of perfection, the term "morality" to my thinking could have no meaning to them because morality is the word we use to describe the tension and resistance naturally imposed in the confluence of true and false components. Since they were created in perfection, I'm sure they were able to understand God's command to not eat as as having consequences they understood intellectually and conceptually to be what would be considered to be and could properly be called "bad". 'Head' knowledge is distinct from knowledge derived from experience. Seems to me they had an understanding of the concepts good and bad but didn't "know" evil until they choose "badly" and infected their essence with fragmental falsity. They went from possession of a wholly true soul to one fragmentally falsified, creating the beginnings of tension and resistance in the mind...hence "morality" came into existence and has been with us since.
This view seems consistent with what followed in the garden, that they suddenly knew to hide from God where previously they enjoyed a face to face relationship. God's pure Truth essence produced tension in juxtaposition with even that small stain of falsity in their souls, causing them to realize they were naked, seeking to cover themselves and hiding from God. We've been hiding from God ever since. (Jn 3:19-20). This view would also be consistent with the gradually decreasing life cycles in Gen 5, assuming value-fragmentation (elemental corruption of true to false) passes causally from essence to matter. Point is, I don't think they knew it was "evil" to eat, even though they knew it was in some way 'off the mark' to do so.
What exactly is sin? The evil act required to get knowledge of evil or having the knowledge of evil itself (which would spiritually defile us)?
I think you come close to the right answer in the latter. I don't see a workable path from
having knowledge of evil to
spiritual defilement. But in the idea put forth above, there seems a viable relationship between the fragmental falsification of the soul, the pressure we call "morality" and moral responsibility for sin.
With respect to the whole individual, falsity of itself is devoid of evil or immorality in somewhat the same sense a living cell is devoid of personhood. Assuming a wholly different set of properties from matter called "consciousness" emerges from material constituents, it seems reasonable to suppose a wholly different set of prescriptive properties (good/evil, morality, ought, ought not, etc.) arise from the fragmental value-corruption of that consciousness.
I personally don't buy the materialistic example, but use it above to model what I agree with you to be a spiritual defect. But the answer to your question 'what is sin?' from this perspective is that sin is a conscious choice to unite with the false--assuming mental content, like the mind which processes it, consists of a variety of fragmentally true/false propositions used from which to exercise the will, or from which to reach a conclusion or choose. Sin is the
at least semi-conscious choice to unite with the false when both true and false are available to the mind to choose between. It's a power available (will) as a function of the intellectual process.
This process of emergence seems also to explain how guilt for wrongdoing can at least conceptually be passed from individuals to a greater whole--the state--such that reparations to the black community for years of mistreatment by a government can be discussed, or the propriety of payments to American Indians for what "we" did to them, etc.