SharePoint Online? What about using Power Automate? There is a SharePoint HTTP Request action that I've used in the past for modifying permissions.... This sample is a bit old (so the screenshots / steps may not match what is currently available), but may get you started: https://noellawlor.wordpress.com/2018/01/18/setting-sharepoint-item-list-permissions-with-flow/
Hilary Stoupa
