Plugin testing leaves mess in registries
Durign plugin testing (test/unit/plugin_test.rb) we refresh the plugin set, but we keep the same registries.
We need to refresh the registries as well, otherwise those are being filled with mocks and other garbage, that should not really be there.
Fixes #31016 - refresh registries after plugin testing
Introduce mechanisms to refresh the plugin registries.
We pollute these during plugin mechanisms testing and it never gets cleaned up.
This makes sure we clean mocks and stubs from the registries.