[1.7.x] Fixed #24000 -- Corrected contrib.sites default site creation in a multiple database setup.

Backport of 89e2c60f4396241c667b7a1de37765b7c96d702f from master