As written in these rules (pdf) and these rules (plain html) (and as you note in your question), it's optional. And also note you can't attack "as soon as you arrive" but rather at the end of the turn (any turn in which your shipping route has reached the fortress that matches your color).
If your shipping route has reached the pirate fortress that matches your color, you can attack the pirates at the end of your turn
The original German agrees:
Sobald ein Spielermit seiner Schiffslinie die Piratenfestung seiner Farbe erreicht und somit die Schiffslinie
zwischen der Piratenfestung und seiner Küstensiedlung geschlossen hat, kann der Spieler die Piratenfestung
Which translates to
Once a player reaches the pirate fortress of his color with his trade route and thereby has completed the route between the pirate fortress and his coastal settlement, the player can attack the pirate fortress.