We had this problem in our app (not using Flutter) and it seems like it was caused by a prebuild script running simctl commands, which somehow deleted/prevented the creation of CLANG_MODULES_BUILD_SESSION_FILE and SDK_STAT_CACHE_PATH from the standard derived data directory.
Topic:
Developer Tools & Services
SubTopic:
Xcode