Details in ENG-11324.
This is not ideal in terms of performance, but on the other hand restored database API is not used a lot, only during restoring (migrations and reading content), so this shouldn't affect performance at all. Alternative requires more changes and could be complicated, probably not worth it.