A very simple script to build a modified Ubuntu WSL image, using docker.
Download the base image from Ubuntu.
Edit Dockerfile and build.sh to suit your needs.
Run
build.sh <path_ubuntu_image.wsl>See this Ubuntu article for a complete explanation without Docker.
Turns out, WSL work similarly to containers, where a kernel is shared, and the distro's just a rootfs. Since the .wsl is a tarball of the rootfs of a distro, we can import it as a Docker image. We can them modify it, either interactively, by launching a container, or by using a Dockerfile. Then we export the modified rootfs as a tarball with .wsl extension.
Just double-click on the .wsl in Windows to install it.