In pure PHP, this is done manually - that is, there are no events. But first, you need to determine which dependency between tables. For example, if the first table depends on the second one, you first add the second record, and then the first one.
For example, if you added an entry to the second table, then, as a rule, both in the PDO and the built-in mysql libraries return the primary key of the entry (unless of course you use InnoDB). If the primary key is returned, then this entry is successfully added, boldly add the next entry dependent on it.
If you want to automate it at the mysql level, then dig in the direction of mysql triggers. You can start from here . But using mysql triggers is highly discouraged because it is desirable not to add logic to the database level!