This - " the layer id to 1 in the arcade expression and it worked." - pertains to data expressions created with Arcade, and is related. In the line below, the bold number is the layer id.
var features = FeatureSetByPortalItem(arcgisPortal, '7b1fb95ab77f40bf8aa09c8b59045449', 0, ['Name', 'Count'], false);
(Explained here - https://developers.arcgis.com/arcade/function-reference/portal_functions/#featuresetbyportalitem)
Because the feature layer's id changed after an overwrite (unbeknownst to me), this failed. I had to change the "0" to "1" (the new layer id) and it worked, but this would not have been necessary if I had been careful about overwriting the feature layer in the first place.
Long story short, keep your layer ids from changing. This really does, frankly, seem like an unnecessary complication, but it's a fact of life.