If you use a non-content language (e.g. your wiki's language is en, but you request messages in fr), MessageCache will query all MediaWiki:*/fr pages from the database and load them. But then when you request a particular message (e.g. foo), it'll query the database again to see if MediaWiki:Foo/fr exists. It doesn't do this extra query for the content language, only for non-content languages.
This appears to be a regression from rMW4fc5ba8bf831: messagecache: check overridable message array in getMsgFromNamespace() (for T193271). It slows down every message fetch, obviously, but in particular it slows down the process of building ResourceLoader's startup module so much that it times out (takes more than 30 seconds) in my local Vagrant setup.