So, I slightly modified Windows version of thdmerge.

in theory it should prepare thd (trueHD) file for blu-ray muxing. 

make file.thd and file.ac3 with ffmpeg

$ ffmpeg -i ~/vid_20210526.mp4 -vn -c:a ac3 b.ac3
$ ffmpeg -i ~/vid_20210526.mp4 -vn -c:a truehd -strict -2 a.thd

compile
gcc -o thdmerge thdmerge.cpp
run

./thdmerge a.thd b.ac3 full.thd+ac3

try to mux this resulting file with tsmuxer