Augment routing tree to include path template.

Storing the path template as part of the payload allows inspection
of this value after tree construction.

Also add a couple of helpers to allow replacing wai-routing's
intermediate list `[(ByteString, App m)]` with `Tree (App m)`, namely
the ability to fold over the tree.