Join module creation with original module discovery.

This is giving a huge performance degradation which will be
investigated.
Adjust module creation for corner cases. Add logging.

The corner case is when events are shared between gates so that there
is chain of non-modularity due to this small group of events.

The other case is when the gate itself is modular but there is
non-shared children present within the module that can be grouped
together.