Any ship choosing to pass through the Strait of Hormuz must understand that it passes through a war zone and sinking is a possible outcome.
That was their choice.
At the beginning of the war, USA has boasted about sinking a large number of Iranian ships, including unarmed ships with a much bigger crew (e.g. 104 crew members were killed when the unarmed frigate Dena was torpedoed without warning near Sri Lanka while returning from India; USA not only did not attempt to rescue the survivors, but later it even attempted to prevent the repatriation of the dead bodies).
There is no doubt that Iran has sunk far less ships than USA in this war and with many times less human casualties.
After USA earlier this year, both in the Iran war and in the naval blockade of Cuba, has amply demonstrated that they do not care about any international laws or treaties, no American has the right to criticize Iran or any other country for illegal actions, because they do exactly what USA has taught them to do.
When you do something bad and someone imitates you, you cannot condemn that action and claim that it is whataboutism when someone else reminds you that you did and continue to do the same. Whataboutism would have been only if a third unrelated party had done something similarly bad and it would have been presented as an excuse, while you, the critic, were innocent and not the original law breaker.
With its Iran war, USA has not attacked only Iran, but it has attacked the majority of the countries of the World, where this has forced price increases in a large number of products, stealing money from the pockets of billions of citizens, which was a very predictable and obvious consequence of the US actions.