A lot of other answers are correct in saying that retaliation is the primary motivation for using prohibited weaponry such as chemical or nuclear weapons. However, in order for this to be true, there must also be few, if any, effective countermeasures to such weaponry.
Chemical weapons are avoided because you can't really defend against them effectively. So although they might be effective against your enemy, they will be equally as effective against you.
Nuclear weapons are avoided because missile defense systems are pretty dodgy and you can't rely on them. If it was possible to effectively defend against nuclear missiles, their use would be much more likely. Cold War actors recognized this early on and 1972 the US and USSR signed the Anti-Balistic Missile Treaty which limited the scope of each nation's missile defense systems.
However, in your example of limiting the effectiveness of aircraft against ships, I doubt that no nation would be unable to develop countermeasures against aircraft. Anti-aircraft guns are simple to make and bullets are cheap. Ships equipped with anti-aircraft gunners could easily provide a defensive screen for a nation's ships that could limit damage. Although opponents would also have anti-aircraft guns, I could see a nation deciding the potential benefits outweighing the risks and believing that they could increase their effectiveness through better training and/or tactics.
In order to entice nations to follow the treaty, you want to throw off this cost-benefit analysis so that breaking it by using aircraft against ships is simply not worth it. One way I think you could do this is by decreasing air density (or increasing temperature, see this answer on the Aviation SE). Decreasing air density or air temperature will make it harder for planes to take off, requiring either longer runways or redesigning planes. While longer runways is easy enough on land, it isn't really feasible for launching off ships: a longer runway means a bigger ship which means a bigger and more expensive target. Since aircraft carriers are often the most expensive and heavily crewed ships in a fleet, nations may want to avoid building them altogether. Even using steam catapults would be hard, as they'd need to be more powerful and they are already extremely heavy and dangerous equipment on board ships.
An alternative of course is to redesign your planes, you could make wings larger, which means more lift but it also means they take up much more space on board your aircraft carrier which means you can't carry as many planes, once again limiting their effectiveness. It could also mean lighter aircraft by carrying fewer explosives, which would of course limit their effectiveness against ships to begin with.
I'm not sure how much less dense air would have to be in order for this to be effective and there may be other side effects I'm not thinking of here, but that's out of scope for this question.
Edit: I forgot something else! A thinner atmosphere would also force planes to fly at a lower altitude, making it easier to hit them with anti-aircraft weapons.