I've tested the following mobs:
Cave Spider
Spider
Creeper
Zombie
Guardian
The trident disappears when you hit a mob. If it misses and hits the ground it returns like normal.
Steps to reproduce:
Create creative world in 20w10a.
Give yourself a trident and enchant it with Loyalty (level doesn't matter).
Spawn a mob, throw it and hit the mob.
The trident will now be gone.
Thank you for your report!
We're actually already tracking this issue in MC-173766, so I've resolved and linked this ticket as a duplicate.
If you would like to add a vote and any extra information to the main ticket it would be appreciated.
If you haven't already, you might like to make use of the search feature to see if the issue has already been mentioned.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki