How to fix the «Table "catalogrule_product_replica" does not exist» Magento 2.2 bug?

Catalog rule indexing failed. See details in exception log.
Table “catalogrule_product_replica” does not exist.

The bug has been added on 2017-06-21 by the following commit:
https://github.com/magento/magento2/commit/944de8d95

It has been fixed on 2017-07-06 by the following commit:
https://github.com/magento/magento2/commit/f5eda851