I just tried dosbox-staging-0.78.0-3.fc35.x86_64.rpm and this version exits normally from full screen mode. This build seems to work well also in other terms but I have not yet tested in detail. Many thanks for finding a quick solution!
Works mostly for me, but crashes when I enter the exit command in full screen mode: "Loguru caught a signal: SIGSEGV" is written to stderr and SELinux alert "SELinux is preventing gdb from read access on the chr_file renderD128." is raised.