I figured out a solution that works for me. In the beforeDispatch() method of my FrontControllerInterface plugin, I have the following block of code:
$requestPath = $this->request->getPathInfo();
// If a coupon code was included in the URL, fix the URL
// after extracting it so that we can continue to route normally
if (preg_match("#/discount/([^/]+?)/*$#", $requestPath, $matches)) {
$coupon = $matches[1];
$this->request->setPathInfo(str_replace($matches[0], '', $requestPath));
}
In essence, I look for the coupon code, and if it exists, I extract it from the URL, then modify the request URL to remove it so that Magento can continue to route normally.
This is doing exactly what I wanted. Hope it can also help someone else in the future.