[HttpKernel] Extract the bundles building code

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes

At least I need that method extracted to be able to add my own code to it