I have achieved something similar for setting the name of my short cut folder based on property decided at run time. I wouldn't know how to change the name of an existing folder though I take it you are looking to rename the folder from something like 'Product v10' to 'Product v11'
When you add the [XXX] directory name, give is a name such as ShortcutCompanyName.
Then add a 'Set Directory' custom action (type 35) that changes sets:
Directory Name : ShortcutCompanyName
Directory Value: [ProgramMenuFolder]\[MyShortCutFolder]
Install UI Sequence: After CostFinalize
Install Exec Sequence: After CostFinalize
Admin UI Sequence: After CostFinalize
Admin Exec Sequence: After CostFinalize
Where [MyShortCutFolder] is a property I have set to the name of the folder I want i.e. XXX or YYY in your case.