There are extensions for Cura that can do almost what you want to do for you (with respect to the layer or height).
You need to add post-processing scripts to the Cura slicer. You do that from the top menu options
Extensions -> Post Processing -> Modify G-Code and then add the option of choice.
E.g. for an event at every layer change you should use script "Insert at layer change" and fill out the G-code you want to perform.
There are options to write your own extension, but that would require some software development skills.
Optionally, you could use the "ChangeAtZ" script to add absurd temperature changes of the extruder to post process that later by a simple e.g. Python script (outside Cura) to replace those actions with the cleaning actions you want to perform. But, when you can do that, you could write a script outside Cura to detect the layers (e.g. from the comments or from the layer change command
G1 Zxx) and insert that right away.
For inserting this on the basis of time would be very difficult, it is difficult to estimate the time printing actions take to then inject such a script.