When automatically placed by a dispenser, Shulker Boxes with items in their inventory do not output redstone signal through a comparator until a block update happens, either for the chest or the comparator.
Can be fixed by calling the method net.minecraft.world.World.updateComparatorOutputLevel(BlockPos, Block)
when the shulker box is dispensed.
This is the world download with a simple contraption to quickly simulate the bug. In the dispenser to the right are the Shulker Boxes with some redstone inside.
By pressing the button boxes are placed but the comparator reads nothing until block update.
Placing the box manually instead works normally