The URL rewrites of Magento 2 will not be reindexed when rebuilding the index via command line. I recommend using https://github.com/olegkoval/magento2-regenerate_url_rewrites to include the reindex of URL rewrites on the shell. This Magento 2 extensions allows for reindexing all URL rewrites.
After installation, run these 2 commands:
php bin/magento cache:flush
php bin/magento cache:clean
Now just reindex as usual, the rewrites will be included.
Reindex URL rewrites
You want or need help implementing this solution? Maybe you did not find what you were looking for? Contact me and I will assist you with whatever Magento problem troubles you!