Hi @matthew.russell,
Generally, the email verification post-login script you shared should terminate the login flow and present the user with an error message.
(Reference: Best Practice of Enforcing Email Verification)
If you are experiencing a SAML configuration error, that might be unrelated. Could you share what was the exact error message you experience?
Thanks,
Rueben