<p>I have a model that contains a cavity, into which I want to insert a piece of metal, so I can use a magnet to stick to the print. How can I introduce a pause into the G-code without manipulating it manually in Ultimaker Cura?</p>

Ultimaker Cura contains "Extensions"; in version 4.1.0, the process is as follows:
Extensions -> Post Processing -> Modify G-code
Add a Script -> Pause at height
Choose the one that matches your firmware!
Choose the
```
Pause height
```
to match the height the insertion should take place. Usually, this is to be the layer just before the roof is to be printed to keep the inserted objects from protruding from their cavities.
Choose a park position well outside of the print. X 10 Y 10 is usually a good position for this.
Add a little retraction if you want.
In printing, you have to wait till the cavity is formed, insert the item quickly and press the control button to resume. The shorter the pause, the better the next layer will hold to the already printed.
Also, keep in mind to make the cavity a little larger than the insert, both in XY and Z, to compensate for the plastic shrinking a little and to allow the nozzle to pass well over the inserted item.