If the files you have issues with are self-created simple files like the text file you depicted, you can run a Terminal command on those files to clear out specific or all extended attributes. This will effectively remove ANY tag you attached previously. Once done, you can re-attach tags in the fashion you already know.
Keep in mind that some applications may use extended attributes to complement the data inside a file. So, deleting all attributes is not always the best idea. For simple (text/image) files, it should be ok however.
Here are the commands to clear the responsible extended attributes:
xattr -d com.apple.FinderInfo /drag/your/file/from/Finder/here
xattr -d com.apple.metadata:_kMDItemUserTags /drag/your/file/from/Finder/here
Here is the command for clearing ALL extended attributes on a given file:
xattr -c /drag/your/file/from/Finder/here
To know what extended attributes are attached to a file, you can run the following command in Terminal to list them:
ls -ld@ /drag/your/file/from/Finder/here
Output from that last command will look something like this:
drwxr-xr-x@ 2 youruser staff 68 Apr 19 14:28 /your/file/from/Finder/here