Fix pytd grammar bugs: UNION, INTERSECT, templates.

Add some pytd tests.
Handle builtins_annotations for templates (missing/bugs are noted).
Fix a few lint complaints.