core: allow route(...) usage inside onsend_route block
- GH #4130
(cherry picked from commit 6343713bcc91a499c772fc6f548597693f220c35)
(cherry picked from commit 0b48c889623a19ed223c252ada049cabebee45f2)
(cherry picked from commit 7335ac5b8d174a14a4481215cc787e7cb5cd4542)