Devices can slow down over time, due to a combination of becoming relatively underpowered (as the OS and apps progress in complexity) and possibly aging memory. Many years ago, Android devices used to have a significant slowdown problem after a certain number of read/write operations on the onboard memory, but this was corrected:
https://www.androidpolice.com/2013/0...ice-slowdowns/. But this does raise the possibility, as you mentioned, that the memory is starting to fail.
If the problems persist in Safe Mode, then you may have to do another full factory reset -- and this time, don't restore it from a backup, and don't start reinstalling apps immediately. See if the crashes and lag are still present with the tablet in a barebones state.