The function you’re using has_sub_field()
is outdated and does not work well with nested flex fields as noted on this page https://www.advancedcustomfields.com/resources/has_sub_field/.
You should be using have_rows()
which is documented here https://www.advancedcustomfields.com/resources/have_rows/