Fix template assertion when opening a session.

Resolves https://github.com/rails/rails/pull/16234#commitcomment-7115670

@senny @rubys
Clearing all the `Hash` instead of creating new ones since the subscribers are registered with the  `Hash` objects created during `setup`. The previous change was breaking because we are actually creating new `Hash` objects in the duplicated context which are not registered with the subscribers.