If unit attacked means if the user attacked at any time during combat. They do not need to initiate combat, deal damage, or survive.
This means that if the foe initiates combat and the user cannot counterattack, the effect will not trigger.
The stat decrease that can be applied by Steel Dagger is considered a penalty.
Any 【Penalty】 on a unit, including penalties, lasts until that unit takes an action. If the unit takes multiple actions in a turn, they will only have the penalty for their first action.
If the unit also has Grand Strategy, any penalties will remain active until the start of that unit's next phase.