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

Due to reasons explained in rails/rails#12367

Fixes problems like spree/spree#3757