Thanks very much! Through comparison with the CustomExporterXML example, I am finally able to locate the error:
The problem is that, when the exportDocument has links within itself, the element being exported may well be contained in a linked document and thus GetElement returns null, causing a skip. This is why I find that OnPolymesh is not invoked at all.
The correct way to do this, as far as I know, is to use Revit.ApplicationServices.Application.Documents property, which retrieves all documents in Revit (including linked ones). So GetElement method should be called on each of those documents:
I hope this would help if anyone else bumps into the same problem...