@Sebastian-Roth So, in the end, I have entirely switched to a bridged network solution, and everything is working fine now. It seems that the problem was, in fact, as you mentioned, about the issue in the installer script with network adapter enumeration. But that also means it is some type of bug - all captures of an image were successful, only failed at the very end trying to update the database.
The difference that I noticed between bridged and internal NAT configuration is that in the latter one, the FOG installer script at the very beginning complains that
net-tools is not installed. When it asked about the network adapters, it couldn’t get an IP at first because it tried to use a network adapter
enp0s3 enp0s8 (NAT adapter for internet connection and internal NAT adapter), at which point I had to specify to use
enp0s8 adapter manually.