How to add tag via text in the notes?

Through a plugin, here are lots of plugins that can generate tags:
joplin/plugins: Joplin official plugin repository. For issues, please use https://github.com/laurent22/joplin/issues Pull requests will be automatically closed.

And this one most likely what you want:
Go to Tag,Notebook (or Notes) via links and by highlighting text in editor - Plugins - Joplin Forum (joplinapp.org)