Per Wikimedia-Hackathon-2018 discussion:
There should be a setting which maps the Wikidata dispatch lag to the API's max lag. This should be a set factor so that the max lag is determined by:
maxLag = max( maxLag, WikibaseDispatchLag / DispatchLagToMaxLagFactor ) where DispatchLagToMaxLagFactor is probably 5 (which would mean bots stop at around 250s of dispatch lag) or 6 (which would make bots stop at 300s… if we were to do this, we should also make sure the respective alert is only fired at maybe 330s of dispatch lag).
This is similar to $wgJobQueueIncludeInMaxLagFactor.
Note: This will need a hook in ApiMain::getMaxLag first. Alternatively Wikibase could overwrite ApiMain::checkMaxLag in its API subclasses… but that's probably the worse solution.