The WiX documentation seems to imply that you can add any attribute to an MsiPackage element (http://wixtoolset.org/documentation/manual/v3/xsd/wix/msipackage.html):
Any Attribute (namespace='##other' processContents='lax') Extensibility point in the WiX XML Schema. Schema extensions can register additional attributes at this point in the schema. The extension's CompilerExtension.ParseAttribute() method will be called with the package identifier in contextValues["PackageId"].
The documentation doesn't give any examples or guidance on how is this actually acheived.
Can anyone provide an example of how to add a custom attribute to a MsiPackage element?
You implement a WiX compiler extension, and possibly a binder extension. You can see the source for the core WiX extensions on GitHub. You can see my pull request for adding the bal:PrereqSupportPackage here for an example.