I managed to find the solution for this.
I removed the 2 lines for QueueProcessingOrder and QueueLimit from my rate limiting logic in RateLimiterExtension.cs file.
Also added app.UseRouting() to my Program.cs file.
My rate limiting functionality now works as desired and returns 429 status code with the message when the number of HTTP requests is limited.