If a device A needs to send an IP datagram to device B and if the arp table of device A doesn't have an entry for the mac address of the device B. Device A will send an arp request packet and in response, the device B will send a reply packet which causes device A to update its cache table. But at the same time device B also update its arp cache table. Now since the path taken by the Ip datagram is independent there is no guarantee a packet for device A will be sent through device B so why does the receiver(device B) update its arp cache table.
That is because most protocols used on a network will be in the form of a request/response. Host A is most likely wanting something from Host B when it sends an ARP request to Host B. Unidirectional communication is not unheard of, but it is far more likely going to be bidirectional communication that Host A wants.
Host B will probably receive something from Host A if it gets an ARP request from Host A, and Host B will probably need to reply to Host A. If Host B didn't update its ARP table, then if would need to send an ARP request to Host A when it needs to respond to Host A. That causes delays and wastes bandwidth, but Host B can simply update its ARP table with no delays or used bandwidth when Host A makes an ARP request of Host B.
Now since the path taken by the Ip datagram is independent there is no guarantee a packet for device A will be sent through device B
Remember that this is all on the same layer-2 network for MAC addresses and ARP. IP doesn't really play any role in delivering layer-3 packets on a LAN. If the LAN protocol uses MAC, e.g. ethernet, then the layer-2 frames are delivered directly from one host to another host.
If Host A and Host B are on different LANs, then Host A would not send an ARP request for Host B, it would know that host B is on a different layer-3 network, and it would send an ARP request for its configured gateway (the host on the LAN that knows how to reach other networks), although it probably already has the MAC address for its configured gateway in it ARP table.