the list of tags is stored in tags-table-list, when you load a file, you know the full path of that file (C-h v buffer-file-name), so you can tweak tags-table-list by buffer-file-name and make it buffer local.
BTW, you need create individual TAGS for each language. For example, one TAGS for javascript, another TAGS for PHP. That's pretty easy if you follow the suggestion from Emacs manual (https://www.gnu.org/software/emacs/manual/html_node/emacs/Create-Tags-Table.html) by using Find and Ctags together because you can specify the file extension when scanning files.
You still need write a little bit Emacs Lisp code but https://github.com/redguardtoo/find-and-ctags help you write less code.