A couple of more questions, plus a suggestion:
1. What tools/procedures do you use for disk cleanup/maintenance/repairs? It would be good if you are specific here.
2. How much free space is on your internal drive?
3. I don't use Time Machine, preferring SuperDuper!. But, is there a way you could get to the backup that was made just prior to this issue happening?
If you can proceed with a restore via #3, you would of course lose stuff that was processed in between that time and now. But maybe an Erase and Format (and if necessary, partition) of your internal drive, then a fresh, clean installation of OS 10.12.5, and then "migrating"/copying that stuff from that backup might solve the issue.