There is a rule that allows both the player and AI to navigate fort's zone of control in this way, which can unoffiicially be called the "Rule of two provinces". Let me illustrate it on the example of this French army.
It was initially in a province north of Gelre, a non-zone-of-control province (meaning that there were no hostile forts around it). The army then marched to your castle through Gelre, and at this point the province where it started its path (north of Gelre) became its
return province. And now, here is the "Rule of two provinces":
if a particular province is within a distance of 2 or smaller from the army's return province, the army is allowed to travel to that province no matter where it currently is. In this example, the French army was most likely allowed to attack your army because the corresponding province (where you were located) was only a distance of two from the French return province: meaning, if you wanted to get from that return province to the province where your army is, you could do that by going first to Friestland (move #1) and then to the target province over the strait (move #2). Since that gives us a distance of 2, the French army is allowed to move to the target province even when located on the castle fort south of it.
Small caveat: the distance is calculated based on only non-zone-of-control provinces, meaning that the hypothetical minimum-distance path can only pass through non-zone-of-control provinces. In this case, through Friestland.
There is more information on how exactly fort's zone of control is applied on this webpage:
https://eu4.paradoxwikis.com/Zone_of_control.
There is also a great YouTube video overview of this system by Reman's Paradox, which I highly recommend. I'm not sure if I'm allowed to post a link to it here, so just search for it, it won't be hard to find.
EDIT: in particular, look at the section "Distance from Return Province" on the wiki page that I have linked above. It says "a distance from the Return Province corresponding to the number of provinces in the shortest [path] ... ... regardless of blocked straits". So it seems that the minimum distance is calculated with allowing strait crossings, even if those straits are blocked. This completely explains the French army's maneuver here.