Turbopack Build: Fix middleware rewrite test (#79697)
## What?
The reason this test fails seems to be that the `browser.on('request'`
gets registered too late and the requests are not tracked because of
that. Seems it can flake with webpack too. Switched to `beforePageLoad`
to register it always. That switch makes the test consistently pass with
Turbopack too.