Wouter Verhelst pointed out on debian-devel that partman has support for preparing and making persistent NBDs: https://salsa.debian.org/installer-team/partman-nbd it would be a fine thing to have similar functionality for ourselves.