No it doesn't make sense really...
You have two options realistically.
1. You add an anal code field to the category table and do a look-up for the categoryId by analcode
or
2. You create a lookup table which just has categoryid and analcode in it and do the lookup from there.
Either way I don't think your trigger is very efficient as it is trying to update all existing product-category mappings for a given category id on a product insert. Why? the product you just inserted will not have a mapping.
Method 1 also means you have to modify a fair bit of nop. ie create/update category etc etc
Method 2 means you only go look for an analcode when you do a product insert or update. either via a trigger or modify the product create/update code in nop.
You do have to keep the analcode-categoryid table up to date so requiring an analcode to be entered when a category is created would be sensible. Of course if a new anal code is created the corresponding category should be created otherwise stuff will break.
Admin users will invariably not create a category to match and wont enter the mapping if they don't have to.
HTH