i use both all the time. gravel races be like that. anything with a decent amount of road along with steep/loose off-road bits. also if you are just super tired or weighed down on steep paved roads.
fwiw 50-34/11-40 also works fine with the rx mech.
i'd also say that the steps in shimano 11-40 aren't super noticeable compared to the 11-34 hg800 cassette and not that much different feeling than their 11-32. certainly noticeably better than sram 10-42 11 speed cassettes.