It broken again this morning, and this time I was able to take a look while it was broken, to see what was going on. (But only briefly because students needed to use this urgently today, of course.)
What had broken was on the course page, where the link to the LTI was displayed. In the broken state, the onclick attribute on that was missing its value:
Once I had fixed it (which I think was basically doning something to clearing the modinfo cache for this course.) then that went back to how it should be:
I was also able to confirm that the actual setting (in the External tool settings for for this activity) had not changed.
So, that is a step forwards in diagnosing this. However, I still have no idea what is really going on here. Anyone got a good theory?
Acutally, this is less weird than it might be. All activities on the course page get a onclick="" attribute because of https://github.com/moodle/moodle/blob/7ce003b666a66b465ce9335f430a6e4d3535a7f1/lib/modinfolib.php#L2168