Like Draco said, the ItemGroup constructor is called before your ItemInit.moditem has even been created. Generally, you can assume that ItemGroups are created before Items are.
This is what I do to get around it:
public class ModItemGroup extends net.minecraft.item.ItemGroup {
private IItemProvider icon;
public ModItemGroup(String label, IItemProvider icon) {
super(label);
this.icon = icon;
}
@OnlyIn(Dist.CLIENT)
@Override
public ItemStack createIcon() {
return new ItemStack(icon);
}
}
public static final ModItemGroup modItemGroup = new ModItemGroup("ModItemGroup", ()->(ItemInit.moditem));
Normally I would use Supplier<Item> here, but IItemProvider already does the same thing with better integration such as being able to be passed directly to an ItemStack's constructor.
This doesn't care whether moditem has already been initialized when modItemGroup is created. It only needs to exist by the time modItemGroup.createIcon() is called.
Either way though, static initializers are unpredictable and that's why I personally avoid them wherever possible.