I'm pretty sure Matomo doesn't use the twig sandbox feature, so this shouldn't matter.
Nevertheless, updating Twig shouldn't hurt.
Just did a code search, did not find anything related to twig using sandbox.
Matomo core does not, but a plugin can. So an update would not hurt.
That would be highly unlikely as not the sandbox feature but just disallowing
__toString() is broken, but as said before I'm all for updating twig (as there were also a few bugfix releases in between)