Why did the cousins decide to attack Hank ?
Yes , I know Hank killed Tuco but don't they know that attacking him will cause the Mexican government to go after the cartel ? Or do they know that fact and choose to ignore it ?
As we know Hank killed Tuco, and we know that the Salamanca family put their family pride/bonding on top priority so due to that they thought (Leonel and Marco) that Hanks should be punished.
The emotions towards the family and its pride tend them to do such action instead of thinking about what the consequences will occur after this step is taken. So basically their hardcore bonding with family at each level (physical/mental/emotional) puts them in a situation where they only think about revenge, not the consequences.