I made a custom tropical fish spawn egg, to try and make a clownfish:
/give @p minecraft:tropical_fish_spawn_egg{display:{Name:"{\"text\":\"Spawn Clownfish\"}"},EntityTag:{Variant:65536}} 1
It worked fine, but if I put the egg in my inventory, then took it out again, and used it, random fish would spawn. I tried it with other color and pattern combinations, to the same result.
Can't reproduce – can you explain what you mean by "put in your inventory and back again"?