International Law is not a law like city, county, state, national laws. There's no court and enforcement agency that can just enforce it. It's a set of agreements between countries. Enforcement (if any) is done by countries based on the goals of those countries. There's no sense of honor here. Yes breaking international law to punish others breaking international law happens, and is sometimes the only reasonable action to take.
It's the prisoner's dilemma. It's better to cooperate, but if the other party defects, your best option is to also defect (which serves as a motivator to renew the cooperation).
The point in having the International Agreements is indeed to honor it.
But only as long and as fully as is possible in the real world
When bad actors deliberately refuse to live within the agreements, e.g., Putin, who has broken nearly EVERY agreement he signed, there are only two choices. Push back with force, or surrender.
At the end of the day, the agreements work to prevent war, but only so long as everyone agrees to be bound by them. When one party unilaterally decides to break out and try to take territory and rule by deception and force, if we fail to respond, the agreements all become moot; the facts on the ground will be that the one who broke the agreements owns and rules everything.
It's brutal, but the agreements exist only as long as everyone follows them.
Moreover there is an entire body of international law and established practice of proportional response. No, these are NOT necessarily "breaking international law".
Start with sanctions. Impound the ships, study the spy equipment, and sell them for scrap. Prosecute the ship operators (then trade them for our political prisoners they hold).
If that doesn't stop it, take proportional and escalating retaliatory measures. Perhaps start with cyber-attacks. Move to kinetic as necessary.
These are just rough outlines; experts in the area can make more refined suggestions.
Vladimir Lenin famously and concisely described the operational algorithm of every petty bully and global dictator:
— “You probe with bayonets: if you find mush, you push.
If you find steel, you withdraw”
Just observe how Putin operates and it will within become instantly obvious that this is exactly how he operates. Obama took no significant forceful opposition when Putin invaded Crimea, and when Assad w/Russia's backing used chemical weapons in Syria. So Putin invaded Donbas, propped up Assad (until he no longer could), then attempted to obliterate the very idea of Ukraine. In contrast, Finland and Sweden joined NATO despite Putin's threats of nuclear war, and Putin then removed troops from near the Finnish border. Putin has threatened nuclear response to "red lines" in Ukraine and EU at least 45 times in in the past three years, and backed down every single time. There are decades of examples.
Attacking other countries' critical infrastructure is an act that could legitimately trigger a NATO Article 5 kinetic response.
Putin is pushing the edges to do as much damage as possible until he gets a response. Diplomacy means nothing; he has and will break every agreement whenever he sees it convenient. The ONLY response he will understand is force.
That does not mean "you touch a chip on my shoulder and we'll nuke you", it means attacking our (collective) infrastructure, committing open murder on our soil, attacking other countries, etc., etc., etc. will see a prompt forceful response that is somewhat proportional and imposes greater costs on Putin.
THAT is the only thing that will stop dictators like Putin and Xi.