Ikabyte It seems, that PHP's dom extension is not enabled! It is possible, that it is only enabled for fpm, but not for cli.
In the list below the message To enable extensions, verify that they are enabled in your .ini files: there should be an entry like /etc/php/8.1/cli/conf.d/20-dom.ini with content like that:
; configuration for php xml module
; priority=20
extension=dom.so