How to format a cell with data YYYYMMDD in Numbers to be a date type?
You can assign you custom format to an empty cell. If you then enter a value that contains a hyphen (-) or a slash (/), such as "1/21/2019", Numbers assumes it’s a date and assigns it your custom date and time format automatically. And keeps it.

Otherwise, if you already have a number in a cell or enter value that is a number, such as "20171214", Numbers cannot recognize it as a date and assign it your custom date format.

Hope, this little video may help to understand as well: https://youtu.be/fUwRHtRLaec