Best practice is prevention. Use a function to delete the row. This function can then remove the dangling references, too, before it returns.
It took some digging, but tables have a has_row
function. An example appears in code under https://anvil.works/docs/how-to/crud-best-practice-guide#security .