Wikibase uses the LoadExtensionSchemaUpdates hook for database schema updates. Handlers of this hook must not modify the database directly, but must instead register updates for later execution. Wikibase does apply modifications directly in:
This can lead to database corruption in production, see T157651.
There is a structure test up for review to prevent this kind of mistake: https://gerrit.wikimedia.org/r/c/mediawiki/core/+/475065. However, it cannot be merged until Wikibase is fixed.