I think two things might be going on here. The not wanting to eat may be related to the sore gums, even if they aren’t sore anymore!
The other weird behavior does sound more like old dog confusion/imaginary things. The last year or so of Val’s life, she changed a bit. It was pretty subtle, none of the typical dementia symptoms, but she had changed. She was more restless, would often go outside at night and just wander around the yard, or stand and stare off into space. I never medicated for it since she didn’t seem distressed, but it was often like she was in a different world.