This appears to be responsible for the regression described in #25653.
This is a complete revert followed by a reintroduction of various tests that it added. I have also added a regression test for #25653.