The answer is to ensure that you select 'With' when you perform the search. Doing this ensures that related contact data is available when you export the resulting data.
Prior to CiviCRM 5.43, 'With' was selected by default. From CiviCRM 5.43 onwards, 'With' is nonot selected so you need to select in while doing the search.
The change was made in this PR: #21595