(I've found this issue when fixing
MDEV-25202. the fix is a part of MDEV-25202 fix )
ON expressions inside a join nest cannot refer to tables outside the nest. This can be "circumvented" by putting the outside reference into a subquery.
A reference to t1.a in the ON expression produces an error, as expected:
A reference from a subquery does not produce an error:
This is wrong/