Even if the tanker briefly entered Gibraltar waters, it's neither here nor there other than for pseudo-justification for something unjustified.
No it is completely fundamental, it is the basis for the seizure, without doing so then the ship wouldn't have broken any sanctions and there would be no reason to seize it. The narrowness of the straits are irrelevant, please don't conflate this with freedom of navigation through the strait or pretend this was maybe related to altering course to avoid another ship as that is just nonsense.
EU sanctions relating to Syria are public knowledge, it is generally a good idea for a big merchant vessel to adhere to the rules of the countries it will be visiting on it's voyage... this wasn't a case of a ship accidentally entering the waters around Gibraltar but rather it was a done intentionally.