I didn’t actually forward the ports because they don’t have to be forwarded for Minecraft to work, but I had port 80 and 443 forwarded to another computer. When I removed the port forwarding rules to the other computer, the 429 error went away immediately.
I've been having this issue off and on for the past few days. It works if I switch to using the hotspot from my phone, but I get the error when I play from my home network.
One thing that worked for me was checking the port forwarding in this article: https://help.minecraft.net/hc/en-us/articles/360035130871-Java-Edition-Realms-connection-issues-
I didn’t actually forward the ports because they don’t have to be forwarded for Minecraft to work, but I had port 80 and 443 forwarded to another computer. When I removed the port forwarding rules to the other computer, the 429 error went away immediately.