DEV: prevents hooks to create leaks on widgets (PR #14207)

Before this, mounted widgets were not correctly unhooked and would keep a reference to a custom widget object.

GitHub