Relands #17489 with a fix for the unit test flake. The previous unit test relied on the new instance not being created at the same memory address, which isn't guaranteed.