If you're not running it as root and you still see a different PHP version when executing the CLI, it might be that the PAM module for containerisation of customer SSH has been removed. Reinstalling ecp-core should reinstate it.
apt install --reinstall ecp-core
If you have run PHP as root, it might have created files as root in the home dir. These should be chowned back to the website user to prevent problems with future composer commands, backups, etc.