Move routing classes to an interface and expose it in the public api

Part of the rework of #4210

cc @DeepDiver1975 @PVince81