I realized after writing that I was being slightly unfair since one valid use case that DOES work correctly is something like:
ssh -X <some host> <command that uses X>
This is occasionally handy, although the best use case I can think of is running a browser on some internet-facing machine so as to temporarily change your IP address, and this use case isn't exactly bulletproof since at least google chrome will look for a running instance and hand over to it (despite that instance having a different DISPLAY= setting). Nevertheless my point stands which is that IMO a programmatic API (either through .so or .dll linkage, or through ioctls or dedicated syscalls) should be the first resort and anything else fancy such as remoting, domain specific languages, /proc or fuse type interfaces, whatever, should be done through extra layers as appropriate. You shouldn't HAVE to use them.
cheers, Nick