If anyone meets this bug, you should check if you declare an inherence from the interface to the implemented class in di.xml with tagpreference tag. Then run bin/magento setup:upgrade
to remove var/generation and cache.
For production, you also need to run:
bin/magento setup:static-content:deploy
bin/magento setup:di:compile