This bug definitely relates to (possibly even duplicates) MC-130351.
I have attached another picture and crash report there
I have just seen this same bug happen on Java Edition 1.18 Release Candidate 3. I have manually crashed the game using the F3+C method and attached the crash report. Also, the issue seemed to fix itself after I restarted the game.
[media]Sorry my screenshot is a bit big.
[media]
Can confirm for 1.21.6.