How to gracefully handle MySQL deadlocks involving SAVEPOINT?
First, some observations/comments/requests:


Please provide SHOW ENGINE INNODB STATUS;, in case it sheds any further light on the issue.
I usually find that SAVEPOINT can be avoided by rethinking the entire transaction.
Since SAVEPOINT seems to be critical to the problem, and it seems to be "broken", please file a bug at http://bugs.mysql.com .
Deadlocks will happen, no matter what you do to avoid them.  It is best to "live with them".  That is, catch them, then rerun the entire transaction.  (SAVEPOINT complicates the code for such.)


On the constructive side, I would recommend improving the many:many OU table by the tips in http://mysql.rjweb.org/doc.php/index_cookbook_mysql#many_to_many_mapping_table -- In particular, its id is both wasteful and possibly contributing to the problem.