With that sample, it's using SceneView, so that works a little different than a MapView.
SceneView won't work at all without WebGL, but MapView doesn't need WebGL, so it doesn't throw an error without WebGL. The cli template app, has it enabled by default and uses VectorTiles which do require it not matter what.
You can do your own detection up front though.
Detect WebGL - Learn web development | MDN
That would be a good solution.