Hello, I am a trainer and I mostly used moodle to deliver my quizzes and assignment. I fully understand there is no restriction parameter on quiz/test referring to itself. However, there is a work-around to restrict access to a test to be available for only students who have failed it.
Kindly reach out, I will sort you out on this as soon as possible without installing any plugin.