refactor: simplify swc loaders configuration (#57457)
Reduce the times that we re-create loaders, down to 3 loaders:
* swc loader for server layer
* swc loader for client layer
* babel loader
This change let us only create some loaders for once, and make the code
easier to read.
`babelLoader` will only available when babel config is enabled, so we
use filters to skip it when it's empty.