Big surprise! (for me at least) If I understood your observation correctly, the actual (hidden?) completion of the quiz has a connection to the setting "When time expires". A value "Attempts must be submitted before time expires, or they are not counted" interferes with the result.
I would understand it, if the dummy student has not submitted within the time limit. But he has as can be seen in his attempt:
I don't see why the student need to be bothered with all the details you explained, if he does his job as advised by the teacher, both the student and the teacher expect him to be able to move forward, i.e. take the dependent quiz. Could you, or anybody else reading this, why Moodle shouldn't?
OK, you said, "This is quite clearly a bug." What is it exactly? Let me put what I believe to be happening on paper, please correct me if I'm wrong or add any information that is missing.
Proposal of a bug report (if not already existing):
How to reproduce in Moodle 4.5.latest?:
- Create a quiz, say Quiz 1, with more than one questions consisting only of machine-graded question types (no essay type, for example). Each question giving a maximum mark of 1 and the quiz to give a maximum grade 1.
- Set a (non-zero) time limit and set "When time expires" to "Attempts must be submitted before time expires, or they are not counted".
- Under Grade allow multiple attempts, Grading method to "Last attempt", and Grade to pass to 1.
- Create another quiz, say Quiz 2, restricting its access to Quiz 1 "must be marked complete"
- Take the quiz as a student. Stay within the time limit and submit the quiz properly (Finish attempt.. > Submit all and finish > Submit all and finish).
IMPORTANT: Answer at least one question wrongly.
- The following preview page should show show the wrongly answered questions marked 0.00 out of 1.00 and as a result the total Marks less than 1.
Expected result: The student must be able to take Quiz 2.
Observed result: The student can't take Quiz 2 it shows, "Not available unless: The activity Test quiz 1 is marked complete".