I managed to comprehensively break Python and grub in my install of Mint 22 due to first messing with various Python versions, then attempting to update grub in order to give me a text-only login. The machine simply wouldn't boot following this.
Booting from a live USB image and chrooting to reinstall/update grub would not work as the Python version was different, removing all Python links in update-alternatives further broke it.
This post gave me enough clues to restore from the live login without having to completely re-install, (thanks @maxirodr) however I found it necessary to make the following minor changes:
Step 1 - as posted (but with the requisite version of Python):
apt-get download libpython3.12-minimal
apt-get download python3.12-minimal
apt-get download python3-minimal
apt-get download libpython3.12-stdlib
apt-get download python3.12
Step 2 - I did not remove the existing python3.12 directory but did clear all python versions in update-alternatives. This may or may not be a good idea for anyone reading this, _be careful_:
update-alternatives --remove-all python3
hash -r # removes cached python3 binary path
Step 3 - just directly install the packages
dpkg -i libpython3.12-minimal_3.12.3-1ubuntu0.5_amd64.deb
dpkg -i libpython3.12-stdlib_3.12.3-1ubuntu0.5_amd64.deb
dpkg -i python3.12-minimal_3.12.3-1ubuntu0.5_amd64.deb
dpkg -i python3.12_3.12.3-1ubuntu0.5_amd64.deb
dpkg -i python3-minimal_3.12.3-0ubuntu2_amd64.deb
Step 4 - not required
Step 5 - as posted (although all I did was to check I got the python prompt ok)
Step 6 - not required
Steps 7-9 - as posted.
I was then able to update grub correctly from the live login and boot back into the machine proper.