He couldn't figure out how to flush the toilet but mentally knew it was supposed to be clean when you leave, so he'd take his poop from the toilet, wrap it in paper and throw it in the trash. Dementia is horrible.
Enjoy this moment. Like all victories, it shall fade.