Revert "Division by constants optimization"
This appears to be responsible for the regression described in #25653 (closed).
This is a complete revert followed by a reintroduction of various tests that it added. I have also added a regression test for #25653 (closed).