This reverts commit 2b48fcc607. It introduced a regression (#20777) which we can't easily fix in 1.6.
2b48fcc607