Existing users with 2FA enabled can't login after apt update/upgrade

Hello, and thanks in advance for any help you can provide.

Here is the information I have that was asked in the thread template:

Nextcloud version:
Operating system and version: Ubuntu 18.04
Apache or nginx version: Apache 2.4.29
PHP version: 7.3.29-1
Is this the first time you’ve seen this error? Yes

The issue you are facing:
This morning, I ran Apt updates and rebooted my server. On coming back online, the server was prompting for installation, and OCC stated that I needed to run maintenance:install. I did, and the server looks to be mostly working - I had to set up a new admin account, which I can log in as and see everything as it should be. However, users that existed and had twofactor authentication enabled cannot log in - I get an internal server error. I have retrieved the error message from nextcloud.log, and posted it on pastebin

Steps to replicate it: Not sure I can give full steps to create the issue again on another installation, but for me it’s just on attempting to log in as any user that was present and had twofactor authentication prior to applying Apt updates and rebooting.

The output of your Nextcloud log in Admin > Logging: Pastebin link (same as above)

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'instanceid' => '[redacted]',
  'passwordsalt' => '[redacted]',
  'secret' => '[redacted]',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    2 => 'hoard.cryptofanatic.net',
  'datadirectory' => '[redacted]',
  'dbtype' => 'pgsql',
  'version' => '',
  'overwrite.cli.url' => 'https://hoard.cryptofanatic.net',
  'dbname' => '[redacted]',
  'dbhost' => '[redacted]',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '[redacted]',
  'dbpassword' => '[redacted]',
  'installed' => true,
  'theme' => '',
  'loglevel' => 2,
  'maintenance' => false,
  'updater.secret' => '[redacted]',

Thanks in advance for any help you can provide!