Additional information: this used to work in 1.19 when I last played on this world, after I upgrade it to 1.21.1 it stopped working.
@Christopher John Crosby
Even when the player removed "tagged" tag, the bug still applies to him/her
This command used to work in version 1.7 but they are bugged now in betas which includes the new 1.10.0.3 beta version
I don't know how to reply but I have updated the report with the information