Core: Allow to configure custom thread pools

Closes #8247