As long as setTransparent() isn't set to null, octree will render black pixels as transparent. For anyone else running into this issue, one workaround is to set the encoder to neuquant instead, which does not have this issue.
Bugged:
const encoder = new GIFEncoder(256, 256, 'octree', true);
Working:
const encoder = new GIFEncoder(256, 256, 'neuquant', true);
Caveat: In certain cases, neuquant colors will not be as accurate.