After few hours the thing that worked for me was disabling and re-enabling Dotmailer module.
php bin/magento module:disable Dotdigitalgroup_Email
php bin/magento module:enable Dotdigitalgroup_Email
Issue was actually caused by incorrectly generated metadata files (at the point of running setup:di:compile there was a symlink created for "generated" folder which somehow made the global.php file to be incorrectly generated). module:enable/disable command made metadata files to be deleted and that is why site started working correctly.
Issue got resoved when we updated deployment procedure and removed "generated" folder symlink before running setup:di:compile.