Reopen "optimize by construction"
Created by: camdencheek
This is a re-open of the reverted PR #35241.
That PR had an issue with the stats endpoint, but when I pushed a potential fix, for some reason the backend integration tests didn't re-run and automerge kicked in.
This adds one more commit (the last commit) to fix that. This would have been fixed in #35242, but we can't have failing test in the mean time.
Test plan
Backend integration tests passed.