I too got the same error recently when I tried to install Emoji plugin. I had to reset all plugin as mentioned in above post and it took almost 5 restarts to get my site back online. As for why it is happening, I don't think I am the right person to answer it.
The problem was I was deleting tags that no longer had topics but was doing it in the wrong place. If a user couldn't see any topics the code was deleting the tag. I moved it up to actually check the tids and not the topics the user can see.