Is there a supported way to register tabStateChange events in javascript via the Xrm.Page API rather than through the form UI, similar to addOnChange for attributes? Something like:
Xrm.Page.getControl("controlname").addTabStateChange(function(){});
Yes. I am not 100% sure it's supported, but it is certainly possible. Here's an example:
Xrm.Page.ui.tabs.get(0).add_tabStateChange(function(){alert('test')})