You may be able to active your objective by creating an Automation on your iPhone. We can try an Automation that reacts to a battery percentage of 30%, for example, and when the battery reaches that level then the camera mode switches to PHOTO. This will stop the Video mode and therefore should stop the recording. In my opinion, this is worth trying.
Open the Shortcuts app on the iPhone ➡️ Automation tab ➡️ + (add an Automation) ➡️ Battery Level (set the desired battery level using the slider) ➡️ Check mark on Run Immediately ➡️ Next ➡️ New Blank Automation ➡️ In the search bar, type Camera Mode ➡️ Choose Photo ➡️ Done
The will save the Automation. Try it out and see whether that achieves your objective.
Axel F.