Meanwhile, FWIW, started monkeying with Siri Shortcuts. Now have voice transcription logger thingie, intending to keep a better daily journal. Now trying to figure out how to lash up Streaks.app reminders with Health.app's blood pressure data. (I know, I should just upgrade to a bluetooth enabled cuff. But I'm stubborn.)
I mention Shortcuts because I'm hoping it proves useful for the quantified self stuff.
I built a 'Butt Pomodoro - A butt triggered pomodoro timer' to solve this problem[1], it gets triggered when I sit and reminds me to move after a scheduled interval, reminds me to get back after an interval and also reminds me take a long break after consecutive sessions.
It's very easy to build, just by changing the schedules it can do what you ask for.
[1]https://abishekmuthian.com/butt-pomodoro-a-butt-triggered-po...
That periodic nudge to actually think about what you're doing and whether it's what you want to be doing could be what you need to keep yourself on track.
For your time to stop alert, the only thing I've found that helps is throwing everything on my outlook calendar - it gives alerts 15 minutes in advance of the appointment and that's enough to make me realize that some task is coming up and I need to prepare for it.
I don't think I've seen an app per se that does exactly what you want
I have chemobrain (and other stuff, TMI). So my mind wanders. I need nudges to get back on track. Like a reverse pomodomo. I used to have a remarkable internal clock (always know time of day, track elapsed time, without looking at watch). Well, no more.
Example 1: An inactivity timer. Like the builtin reminder to standup and stretch. Once or twice a day, I just have to sit down. I'll pop some pain pills then veg until they kick in (30-45 min). I never remember to set a timer, alarm. I want my phone to notice I've been vegging for an hour and remind me to start moving.
Example 2: Time to stop. I'll start doing a mindless task, usually physical. Like weeding or picking up litter. It's super gratifying. But then I'll overdo it. I want my phone to notice I've been stuck on the same task for too long.