[1.7.x] Checked more precisely whether the app registry is ready.

Accounted for the three stages of population: app configs, models,
ready() methods of app configs.

Backport of a764a9cc from master
[1.7.x] Fixed #22939 -- Delayed admin_static backend detection

Thanks generalov for the report.

Backport of 22b2fb0b from master