This reverts commit 1702bc52cc20ed0729893177fc8f4391b4b3183c. This doesn't work on stable/1.7.x because #23844 wasn't backported and we're not willing to do so because it's a large change.