Transcode 5.1 audio in ffmpeg leads to incorrect audio mapping in output
FFmpeg assumes that the input's 5.1 channel mapping is the same as the one it uses. To correct that, use the channelmap filter to remap, add:

-af "channelmap=4|0|1|2|3|5:5.1"


(I based it off the channel labels on the right in your images)