The older commit was to make the plugin compatible with an older version of trac, I forget exactly which one now, but I think 0.11.7. The newer commit is a fix for trac 1.0.
In trac 1.0, the plugin seems to cause an infinite loop. Before plugin initialization is complete, tracmath init is called, which attempts to load the template, which triggers the trac plugins to be initialized again (since it hasn't finished initializing at this point), and so on.
Basically, I just made the template a property, and I load the template on first access.