Add lifecycle method to all components, or listen for connected/loaded

I would like to know when a component instance is first rendered on a page.

There seems to be a couple of ways of tackling this. Inject something in the build that adds a lifecycle method to all components (like componentDidLoad) or listen to a loaded event that is emitted from all components when they are first loaded.

I have seen whenDefined, but that only applies to the component first load rather than the instance.

Any ideas how to achieve this?

Edit: This also applies to components nested in shadow dom of other components