Found the issue. I was using files which were on the Windows file system (/mnt/d) as from my understanding, files created on the Windows file system can also be used by the Linux Subsystem.
It looks like some of the Linux Ubuntu tools do not like using these shared files.
I am now cloning the Tezos repo straight into the Linux file system.
I was able to make it work, you need to disable bubblewrap which is used by opam but not supported in WSL. You can do so using the --disable-sandboxing flag.
This comment by user jdsika includes all the steps needed to run Tezos on WSL2.
Note that Windows 10 version 2004 is needed. https://docs.microsoft.com/en-us/windows/whats-new/whats-new-windows-10-version-2004#windows-subsystem-for-linux-wsl
I seem to recall similar curl errors when building on older versions of ubuntu and debian. The solution there was to install a newer version of git. Look for references to "git" in https://github.com/tezoscommunity/FAQ/blob/master/Compile_Mainnet.md