Ensure target directory exists with building rust extension

When packaging mercurial for Gentoo with rust, the build always fail with the error:
error: [Errno 2] No such file or directory: 'build/lib.linux-x86_64-cpython-39/mercurial/rustext.cpython-39-x86_64-linux-gnu.so'

The build/lib.linux-x86_64-cpython-39/mercurial does not exist, but if I build first any other extension than the directory exist and the build works.
I do not know why this appears for version 6.3.2 but not for previous one.

Merge request reports