I suspect this has also been an issue in versions way before 1.21, however I did not see any report regarding this. If it is a duplicate though, then I am terribly sorry for the inconvenience.
can confirm in 1.21-rc1
can confirm in 1.21-pre1
probably also affects every version from 24w20a to the pre-release
updated title and description accordingly, thank you @tryashtar
UPDATE: I can confirm it still being that way in 1.21-pre1. Furthermore, I can confirm that this issue wasn't limited to just the 'post_attack' component, as it actually affects every effect component
I haven't tested it on versions earlier than 24w20a, but I am quite sure that this has been an issue since 24w18a, when the enchantments were made data-driven
still present in 1.20.5-pre1
confirmed in 24w10a
can confirm in newest snapshot (24w07a)
can confirm in 23w32a
still present in 1.21.4