I don't see the problem. They got instruction. Sure it wasn't planned in advance, but they could have discussed what they were going to do, inflight, before the instruction started.
The pilot needs to log the time under instruction (it's a legal requirement to do so).
As it's a real flight, rather than a routine training flight, a lot of useful stuff can be learnt that wouldn't normally experience. (eg a pilot figuring their way around on an airport that they aren't familiar with....instructors are very familiar with the airports that they bring students to). If the pilot is tracking a VOR, there is no reason to leave that on the autopilot. Might as well give it to the student, and give them some lessons in how to do it properly.
I'd log the actual take off and landing times (no point in making up ones) but for the duration, I'd only long the amount of time actually under instruction.