The answer to this is that shortly after you remove a like, the like alert will disappear from other people’s activity view. If you’ve accidentally liked a photo and then disliked it, the person who posted the photo will get a push notification (if they have notifications turned on).

Instagram photo like unlike will they know you unliked

If you like a photo, unlike it and then hit like again, the person who posted the photo will only receive one activity alert for the latest like and one push notification for the original like if they have push notification turned on.