Create a custom router mapper so we have more control over the routes

Due to reasons explained in rails/rails#12367