The problem that we will run into is access to the services listed in the pen. I am pretty sure that you will not be able to access the services used so you may need to add some ESRI services to replicate the issue. The services are U/V NAVGEM data for winds with wind speed for the raster stretch color layer and U/V WW3 lvl 0 for the waves. Hopefully there are already active services that will replicate these.
I used the services from your pen and the problem persists.
FlowRenderer layer switch test (codepen.io)
This pen replicates the issue with the necessary basic functionality, some of which is probably unnecessary but it has been added in the interest of best replicating the situation. The control div shows up to the right of the visible screen, so you will need to scroll over to access it. Toggling on the wave layer will add the waves then toggling the winds back on will fail to add the winds and produce the error in the previously attached image.
Here is the error from the codpen,
"[esri.views.2d.layers.imagery.ImageryView2D]" // [object Object]
{
"name": "TypeError",
"details": {
"stack": "TypeError: Cannot read properties of undefined (reading 'symbolize')\n at z.A.symbolize (https://js.arcgis.com/4.23/esri/layers/support/RasterWorker.js:469:453)\n at u.D._onInvokeMessage (https://js.arcgis.com/4.23/esri/core/workers/init.js:111:462)\n at u._invoke (https://js.arcgis.com/4.23/esri/core/workers/init.js:105:336)\n at u.D._process (https://js.arcgis.com/4.23/esri/core/workers/init.js:105:135)"
},
"message": "Cannot read properties of undefined (reading 'symbolize')"
}