Can't log to debug log before chain params initialized

Add a function `AreBaseParamsConfigured` and use this to check
before writing to the debug log. This avoids assertions when the
application happens to log too early, which happens in the GUI.

Messages logged before the base parameters are configured can be
shown using `-printtoconsole`.
ui: Replace some LogPrintfs with qDebug()

These are relatively unimportant messages, so don't need to be logged
without -debug=ui.
qt: Start core thread only when needed

Start the core thread only when needed for initialization
or shutdown.

Avoids a bit of overhead, and also avoids spamming two
log messages before logging is properly initialized.
Merge pull request #4534

33357b2 qt: Start core thread only when needed (Wladimir J. van der Laan)
c715ff5 ui: Replace some LogPrintfs with qDebug() (Wladimir J. van der Laan)
96ff9d6 Can't log to debug log before chain params initialized (Wladimir J. van der Laan)