Why not use auto commit off in the session or .psqlrc file or begin and then use rollback? \set AUTOCOMMIT off
What would be nice is if a syntax error didn’t abort the transaction when auto commit is off — being a bad typist.