Well, it sure as heck does not solve the problem for those programs
that use mktemp() or some similar function on a string liek
"/tmp/fooXXXXXX". It also does not fix the problem for daemons or
setuid tools, which sure as heck should not be honouring TMPDIR at
all.
These are simply source code bugs, and they should be fixed.
In OpenBSD we have fixed hundreds of these /tmp races. I do not
believe there is a simple answer. And if someone does invent a magic
solution later on that helps, it won't matter because by then we
should hopefully have finished fixing the last of these programs.
A person who codes a /tmp race into their code today is no different
from a person who codes in a buffer overflow or who uses gets().
TMPDIR does not exist primarily for use as a workaround to a
serious and very common problem. (No problem should be "solved"
by requiring each user to set an environment variable).