My favorite dog of all time, a 116 pound black lab, had dementia in his 14th year. He would have lots of good days when he seemed fine and still quite athletic, and some really bad days when he didn't know who I was. I don't remember the medication he was on and there have probably been advancements since then.
Since he had a lot more good says than bad, it wasn't until his physical condition deteriorated badly that we made the decision to end his suffering.
One of my first posts - maybe the very first here was my memorial to that great dog.
Good luck. It sounds like you have a handle on things and will do right by your old friend.