When my kid’s upset, they have trouble constructing words and will often result to just saying random things that are semantically appropriate but not true.
I think of remembering as two separate experiences: one is passive where a memory pops into your mind and the other is active where you try to remember something that happened. The active one is a skill which involves trying to predict triggers for the passive process to trigger those memories manually.
And I think of lying as interacting with that process in one of two ways: conscious and unconscious. Conscious is when you remember the truth and intentionally avoid it. Unconscious is when you have a sense that the truth will be harmful and make a point of not remembering so you can say something else.
Meanwhile, what my kid is doing isn’t either of these things. It’s not an avoidance of the truth. It’s a deficit in ability. They literally can’t recall the truth in the moment despite wanting to.
Calling it lying seems harsh and inaccurate, but I don’t know what else to call it or really how to help them navigate this. I just got shamed as a kid until I figured it out.
Wat do
Misspeaking/misremembering seems perhaps most accurate to describe what you're talking about. Fabrication as well (I just came upon it below).
You might also talk to them (when they're not agitated) about things that aren't true/right, then can work that in when they are agitated.
You're correct that a lie is generally an intentional action (one knows the truth and chooses to misconstrue it), and if your kid simply can't remember what is true/what isn't it's closer to fabrication (another good word) where things are "made up" but not necessarily with the intent to deceive.
Still, it's a tricky situation, especially since memory is so complicated.