Use Flow Builder to Create a Roll Up Summary Field shares how to calculated related records without using the “Roll Up Summary” field type. It’s useful especially when the two objects don’t have a parent-child relationship.
But this video doesn’t work for deleted records, the process will be triggered only when a child record is created or edited. You need to change the counting criteria, business process, and object permission.