Create a table (insert > table) from your data and called it "data".
Use this formula:
=LET(cntCountries,COLUMNS(data),
cntRows, ROWS(data)*cntCountries,
shortCodeByRowλ,LAMBDA(r,INT((r-1)/cntCountries)+1),
countryCodesByRowλ,LAMBDA(r,MOD(r-1,cntCountries)+1),
shortcodes,MAKEARRAY(cntRows,1,LAMBDA(r,c,INDEX(data[Short Code2],shortCodeByRowλ(r)))),
countrycodes,MAKEARRAY(cntRows,1,LAMBDA(r,c,INDEX(data[#Headers],1,countryCodesByRowλ(r)))),
selection,SUBSTITUTE(MAKEARRAY(cntRows,1,LAMBDA(r,c,INDEX(data,shortCodeByRowλ(r),countryCodesByRowλ(r)) )),"x","I"),
FILTER(HSTACK(shortcodes,countrycodes,selection),selection="I"))
The fundamental concept is to base each column on MAKEARRAY. Depending on the row of the new array, the values are either pulled from the short code column or the header country codes. employing both LAMBDA functions.
The HSTACKEd array is filtered for the I rows in the result.
To retrieve either the shortcode or the country code for the row, there are two lambdas.