When doing some tests in creative mode with named Pillagers, I discovered that if I went more than 128 blocks away, they'd despawn. They had names, so i was confused. After some testing I tried again by spawning them and using name tags, and they did as expected and didn't despawn. I found the same with Zombie Pigmen.
So if you spawn hostile mobs from renamed spawn eggs, they will be named, but still despawn. I consider this a bug.
Thank you for your report!
We're actually already tracking this issue in MC-54556, so I resolved and linked this ticket as a duplicate.
However, that ticket has already been resolved. That means that this is not considered a bug and won't be fixed. Please do not leave a comment on the linked ticket.
If you haven't already, you might like to make use of the search feature in the future to see if the issue has already been reported.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – 📖 Game Wiki