This seems to be fixed in 1.21.2-pre4. Not sure why as nothing in the changelog mentioned anything that fixes this, and this bug report (as of writing this comment) is still unconfirmed and unresolved.
Edit: this actually does work in 1.21.2-pre3. Not sure how I missed it before since I thought I tested it pretty thoroughly.
This seems to be fixed in 1.21.2-pre4. Not sure why as nothing in the changelog mentioned anything that fixes this, and this bug report (as of writing this comment) is still unconfirmed and unresolved.
Edit: this actually does work in 1.21.2-pre3. Not sure how I missed it before since I thought I tested it pretty thoroughly.