This appears to be an interesting dependency ordering bug on our part. I'll enter this into our database and ensure we get tests in place for this.
In the short term, the workaround would be to manually tweak the script before deployment to put the key drops in the proper order.
Thanks very much for bringing this to our attention.