dmenu tip now has an option in config.mk allowing you to specify the path of dmenu_path's cache, either absolute or relative to $HOME. It doesn't let you do anything involving environment variables, as true XDG would require, but you can at least make it dump the cache in a directory of your choosing.
(Right now it doesn't actually mkdir -- is that desired?) Thanks, cls