Extract `createAppRouteCode` from `next-app-loader.ts` (#70352)
This is a small refactor in preparation for adding more logic to
`createAppRouteCode` in a future PR. This change allows for a more
focused diff when reviewing the upcoming PR.
In this PR, all code lines are moved to the new file without any
modifications.