WITH position unexpected position using Mysql 8.0 Date Generation
Recursive CTE implemented in the MySQL 8+ requires the next syntax:

WITH RECURSIVE tbl (a,b,c) AS 
(
  SELECT ...  -- initial portion of rows
  UNION ALL
  SELECT ...  -- recursively added rows
)
SELECT * 
  FROM tbl
   ...
;


Refer to the documentation/primers for the proper recursive CTE using.