Hey Sir, What's your current username and which username are you trying to set?
You can use Mojang API to get much more info about the current used names and so on.
does this keep happening after trying to reconnect? My question might seem odd, but did u try different accounts in order to check that it isnt a Minecraft issue that happens on one account but rather an issue with your computer (Networking settings, Proxies, and so on)
If you are trying to purchase games as a gift from certain regions, it wouldn't let you do so, The only region I can remember right now is Egypt.
Which region did you choose while buying?
Can Confirm on a Samsung A15 8gb ram (Helio G99), and a Redmi Note 11 4gb ram
The Lag spikes mostly happen randomly, they last around 0.3-0.5 seconds