No, I certainly wouldn’t mess with the core files 🙂
But that’s exactly what I was looking for, thanks!
.layout[data-layout="flexiblefieldname1"]
In the meantime I helped myself with this, which is quite alright:
https://wordpress.org/plugins/advanced-custom-field-repeater-collapser/