Thanks for the detailed report.
The issue was reported recently by another user (https://forums.ankiweb.net/t/2-1-56-qt6-pressing-space-after-mathjax-inserts-nbsp-with-escaped/26147), and has already been fixed in the current development code, so the fix should be included in the next release.