I hope you don't mind to get some feedback for the GitHub code..;)
1. You should mention that it will include ALL topics;) It will even show hidden/soft deleted topics and also topics from forums which the user is probably not allowed to see.
2. You should add the app and type to the query because the core_reputation_index table can have more then a row with the same item_id ( e.g. topic 1 and blog entry 1 will both have the same item_id in the core_reputation_index table
'likes' => \IPS\Db::i()->select('COUNT(id)', 'core_reputation_index', ['item_id=?', $_dbTopic])->first()