The addon extends XenForo_Model_UserUpgrade::upgradeUser. The query runs when you manually upgrade a user in the Admin CP, but not when you make an actual purchase. Both actions call on the same function, but only the manual upgrade runs the extended code. I did some debugging to confirm this. The manual upgrade hits both the parent and extended function like I want, but an actual purchase only hits the parent.