They liked a post. Un-liking a post does not change that they have proved that they know how to like a post. Perhaps they are eligible for a First Unlike Badge, but now that they have liked a post, they have liked a post. They get the badge for having liked a post. You can’t un-ring the bell.
That’s my guess.
Your solution was very clever. Another way to remove their badge would be to delete the user. ![]()