in x~y, the x is a glob pattern, but y is a string pattern. **/ is
only special in globbing where it is a shorthand for (*/)#. In string
matching it simply means any string followed by any string followed by
a slash. Additionally, in a string pattern, the "any string" can
include a / which it cannot in globbing, meaning that even x~*.tex
will exclude foo/bar/baz/quux.tex for example if that was generated by
the glob pattern x, because the * will match foo/bar/baz/quux.
Note also that ** on its own is not special in either context, only **/ is.