Flatworms branched off our side of the animal tree of life very early on. They're on the same side as molluscs, some of whom (cephalopods) are famous for having a more distributed nervous system.
Granted though many/most organs are stateful and somewhat adaptive - in a sense they'll "remember" what happened. Even plants possess that to varying degrees.