Thats very simple, because you called it from the commandline which relies on the cli SAPI of php. That one uses php 8.3:
readlink -f $(which php)
You should realy remove all not used php packages:
sudo apt-get purge *php7.0* *php8.3*
then you should get rid of all unnecessary dependency packages.
You can install and run the php-updater script, it will give you comprehensive information about which package is a dependency package and which one is not.
It comes with an extensive help guide. Read it carefully, then - I hope - everything will be clear to you.
ernolf