[1.6.x] Fixed #20681 -- Prevented teardown_databases from attempting to tear down aliases

Thanks simonpercivall.

Backport of d9c580306c from master