Okay, it seems like I've fixed it with the help of some people at a Discord server. I'm sharing the solution here in case someone runs into the same problem and locking this thread. Sorry for the (unintentional) spam!

What I needed to do was install php7.3-memcache and php7.3-memcached:
sudo apt install php7.3-memcache php7.3-memcached memcached
and then change the default php version from 8.1 to 7.3:
sudo update-alternatives --config php
Finally, then I restarted nginx and php fpm:
sudo service nginx restart
sudo service php7.3-fpm restart
That fixed it!
