The fence glitch when you don't have optifine on.
To make it work in Minecraft Vanilla, it is a pretty dumb solution.
Apparently minecraft vanilla doesn't like when there is an uppercase in the name of a model.
When you go in the model of the netherbrick fence (minecraft/models/block/fence/nether_brick), there is 2 json file named :
Juste replace the uppercase character by a lowercase one.
Then you will need to go in the blockstate of the nether_brick_fence to make the same change, uppercase to lowercase