The problem is that the Upgrade component passes a string (the name of a template) where ApplyValueModificationsToTemplate expects an object (the template data).
(This is exacerbated by the fact that it's not even the correct template name. In this part of the code, you're modifying the cost of a given upgrade, the values of which are stored within the template of the current entity, not in the template of the upgrade.)
The second problem is that the component doesn't provide the correct modifications path. My mistake... ?
Thanks to @fatherbushido for drawing my attention to this (even if I'm not too sure he meant to ?)