Introduce something like bd_fs_mount_ns() that would mount directly into a specific namespace. See e.g. mnt_context_set_target_ns() and mnt_context_switch_ns() available since util-linux-2.33.
As a next step, make use of a private mount namespace for all temporary mounts made by libblockdev.