This partially reverts 192a9d95 (#19432). Fixes #20305. (cherry picked from commit 74c1ab84)
mentioned in commit 427dd58a