“ICMP is a very, very old protocol. It is defined in RFC 792, which was published in 1981.”
The answer is the ICMP id field. Netfilter treats it as a port, keeps it when it is unique, and picks a random replacement from 0xFFFF values when two clients collide. Run out of attempts and the packet gets dropped. The RFC never said how to choose the id, so the kernel quietly made it up.