The way Infinispan is working is correct. Invalidation means that when a node receives a put/replace/putIfAbsent/remove calls, it will send a message to the other nodes to remove the entry. So, when the entry is stored in cache2, it's removed from cache1. It doesn't verify if the value is the same or not.
JSR-107 does not specify how caches should behave in a cluster. JSR-107 only focuses on local caches. The behaviour of Infinispan caches, even under JCache API, for invalidated, distributed and replicated caches is specific to Infinispan.