Here in maridb repo https://github.com/MariaDB/server/blob/a812dba6dc881a8a7fbd9bcc1451d2e54c92575c/sql/sql_lex.h#L45
You can find string #define SELECT_NESTING_MAP_SIZE 64
So maximum nesting is 64. You can incrase this value and rebuild mariadb.