I was able to loosely code something which does this in Python, but I was just wondering if there was a known mathematical formula or proper algorithm which estimates these points. I've marked "starting points" in green and "ending points" in red.
My intuition led me to estimating the second-derivative and doing peak detection on it, but I'm sure that my hunch isn't some novel invention, so I'd just like to make sure.

I don't think there's a canned routine to do that. However, here's an idea, if you want something besides what you've already coded up.
You can do this in reverse to find the ends of valleys. That is, to find the ends of valleys, you "look forward" with your secant lines. To find the beginnings of valleys, you "look backwards" with your secant lines.