How to recover from accidentally deleting Snap from Ubuntu installed as a part of WSL1?

I’m running Ubuntu 22.04.5 LTS in WSL1.

In the process of trying to upgrade Ubuntu, I made a horrible mistake of deleting Snap. And the OS is basically trapped in a broken state where nothing can be installed.

> sudo apt-get install snapd
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
> sudo apt --fix-broken install
Could not read response to hello message from hook [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt 2>/dev/null || true: Success
> sudo apt purge snapd
E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
E: Could not read response to hello message from hook [ ! -f /usr/bin/snap ] || /usr/bin/snap advise-snap --from-apt 2>/dev/null || true: Success