The issue was that boolean custom data layers were not written to files, because the dna struct name bool does not exist. Adding a struct that just contains a bool/uint8_t does not seem to be possible, it looks like the minimum dna struct size is 4 bytes.
The proposed solution has two parts:
- Write the custom data layer using BLO_write_raw instead of BLO_write_struct_array_by_name.
- When loading a file, reinitialize any custom data layer that was not saved correctly (this is just a fix for existing files).