Hi Johann,
There are few ways we can achieve it,
You can listen to the JCR on event method. However in case of load on instance such implementation may cause troubles.
Better possibly is to write your own filter that will trigger before file gets uploaded to the repository (1)
Additionally, AEM has wonderful Workflows system OOTB, please check it out to see if it can work for your usecase.
(1) https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/aem-6550-modify-the-filena...
Regards,
Peter