Say you move a bunch of apps to the SD card. Then you do something big, like factory reset your phone or install a new ROM. What happens to the apps that have been moved to the SD card? Are they still there taking up space but no longer accessible? Does this mean that apps moved to the SD card should be uninstalled before rewriting the system?
Yes. You need to uninstall or move the app to internal storage
When an app is moved to SD ( in versions before Marshmallow or portable storage of Marshmallow ) it does not move the complete app to SD card. A portion of the app remains on internal storage - that's why when you upgrade to a later version of app it again reverts to internal storage and you need to move it to external SD
When you install a new ROM or factory-reset only that portion of what is on your internal storage is being overwritten. The portion of app on external SD occupies space, though it cannot be used. So to reclaim that space you would need to uninstall the app first or move the app completely to internal storage
If you are using the adoptable-storage feature, then you are treating the external SD as internal storage anyway, so you needn't bother doing this
See Appendix 2 and 3 of this reddit for additional reading