How to force regeneration of Twig templates?
Not sure why you get that specific error, but have a look at drupal_flush_all_caches(), which does

PhpStorageFactory::get('twig')-&gt;deleteAll();


That said, I'm not sure if this will solve your problem, as I've never seen that error, not sure how it could end up expecting a class that is not there.