PHP Fatal error: Uncaught Error: Undefined constant "MB_OVERLOAD_STRING"

I found the solution. When I run the commands from CLI the PHP version is 8.1, even though I use PHP7.2 for mautic.
Running the commands with php7.2 console -V etc doesn’t cause the error.