When we moved from Mx8 to currently Mx9.12.5 we also encountered that sometimes a retrieve over association was suddenly empty in submicroflows. Fix was indeed to retrieve it over the database. We did create a support ticket for this because this used to work and after the upgrade it did not anymore and that should not be happening.
I have noticed some odds in Mx9.18. In my case, without explicit retrieve some associations, the “List Operator Filter by Expression” didn’t worked as expected…
I’m suspecting that we have new bugs in this version. As retrieve by association works as lazy load when the association is not in memory (internally mendix must retrieve from db)
But, for the case you stated, looks similar this thread → https://forum.mendix.com/link/questions/14232
Maybe the Garbage collector is removing the objects…
If your MF is running with already persisted entities, you may try change your Retrieves by Association to Retrieve From Database.
If it solves your problem, please fill a Bug Report in Mendix Support !