How to customize dataloader creation in trainer?

Is there a way I could re-create the dataloader after each epoch through a custom function when using trainer?

No, you should probably use a manual training loop for that, using the Accelerate library.