refactor: updated route regexp handling to simplify (#74996)
Previously we had to do a lot of custom RegExp source mangling in order
to preserve extra bits (like the `.rsc` or `.json` suffixes) on dynamic
route parameter segments. This updates the handling to simply includes
those in situations where it's desired.
Unit tests have been created to verify the new behaviour, no additional
e2e tests should need to be adjusted.