Revert "[build] removed obsolete monkey patches"

This reverts commit 30dad24258def97464b4db9818655df8eb5faaa9.