In my plugin we listen to the user_enrolment_* events so we can sync Moodle users to our service when an enrollment is created, updated, or deleted.
It looks like these events are firing before the role is given to the user in the course context and that is causing teachers to initially sync as students in our service. We check to see if the user has a creator(teacher) capability during the enrollment event, and by the time our sync code fires the user does not have this capability in the course context so they are being assigned a viewer(student) role instead.
We assign this capability to the teacher role before enrollment happens so I'm not sure what can be done on the plug in side to fix this behavior, I would expect when the enrollment event fires the below code should find the capabilities in the context of the course they were enrolled in:
$canprovisionaspublisher = has_capability('block/panopto:provision_aspublisher', $context, $userid);
$canprovisionasteacher = has_capability('block/panopto:provision_asteacher', $context, $userid);
I expect this to happen on all version of Moodle, I believe customers experiencing this are using different versions.