Well did you remember to
"sudo anbox-tool disable
sudo mount -o rw,remount /"

like in the script?(and reverse afterwards)

I never got opengapps to work but I think to edit the system I ended up copying the android.img to another directory, running unsquashfs on it, modifying it, resquashing it (mksquashfs) and then overwrite the original image.