How to replace libapt-private.so.0.0.0 manually on Ubuntu for Windows?

So, my WSL got broken because of Windows Defender detecting my libapt-private.so.0.0.0 as a trojan. [insert ironic comment here]

(UPDATE: This SO answer reports some news from Microsoft on the issue)

Solution

First of all, the most annoying thing was that every attempt to delete or move the library gave "Permission Denied" error. In order to prevent this, make sure you are operating as Administrator: open your WSL shell from an elevated cmd/powershell and work there.

What follows is (almost) the implementation of Imaginecat22's answer.

  1. Find your version of apt

    $ dpkg -l apt
    
    [. . .]
    ||/ Name                              Version               Architecture          Description
    +++-=================================-=====================-=====================-=======================================================================
    ii  apt                               1.6.11                amd64                 commandline package manager
    

    write down the value of Architecture.

  2. Download .deb package

    Most packages can be found with the Ubuntu package search.

    Not all versions are available there though, so you may need to download manually:

    • use a web browser to open:

      https://launchpad.net/ubuntu/+source/apt/<VERSION>/

      Replace <VERSION> with the value of Version returned in step 1, e.g.:

      https://launchpad.net/ubuntu/+source/apt/1.6.11/

    • Find the Builds section and select the build that matches the Architecture value from step 1.

    Copy the URL to download the file apt_<VERSION>_<ARCHITECTURE>.deb. From your WSL Linux shell download the package:

        $ wget https://launchpad.net/ubuntu/+source/apt/1.6.11/+build/16829590/+files/apt_1.6.11_amd64.deb
    
  3. Install package using dpkg

    $ dpkg -i apt_1.6.11_amd64.deb
    

Should overwrite your previous version and the broken library with it.