The devil invented “sin”, a way to misguide our brains.
“Sin” is a DoS attack. It can be reformulated in another way (even if you don’t know what “DoS attack” is):
Sin is a too hard problem which overwhelms our brains and makes us unable to think properly about other problems.
So, we can conclude that sin is necessary, because that a problem is too hard does not make an allowance to skip it in the study. Sin needs to come into the world in order to be overcome (“solved”) organizing such a relationship between us and God which make it no problem anymore.
So the existence of sin and the devil are necessary. It is a part of the plan of God.
This is the explanation why all sufferings are necessary, as sufferings are just coming through too hard problems. But no problem is too hard to not be necessary to appear to be solved.