This mirrors 1f78e86070 from 2018 for mesh modifiers. Differential Revision: https://developer.blender.org/D7940
1f78e86070