The commit 728bbc4 does not seem right, it is setting branch expire to the dialog value, which is not correct.
As for commit cf70716 -- the tps_storage_end_dialog() has a check inside to be executed only for BYE:
* https://github.com/kamailio/kamailio/blob/master/src/modules/topos_redis/top...
Can you check if you have the same code base, give that you said you run some custom version.
If you have it, then maybe the issue is somewhere else, not setting properly the method id in the structure.