Geez I would hate to think that the tax man can legally do what you say.
Especially as , conversely , I have made some profits on buying & selling on some shares before the Trade + 3 days is up .
So tax is due on those profits which is why I take the opportunity to sell , & then buy back , for the capital loss to offset those gains.