The Pope Pius XII in the encyclical AD CAELI REGINAM recognizes Mary as the "queen of heaven", although historically she was already known that way. If the Pope knows the Bible, why not distance himself in his encyclical from the references to the "queen of heaven" found in Jeremiah chapter 7 and 44?
Because it's obvious to most people that Jeremiah 7 is referring to a false pagan deity, and not the blessed virgin Mary. To associate the two is to give credence to the idea that they are somehow related, which they obviously aren't. Highly venerating a female whom you believe God has made Queen of His Kingdom (something theoretically very possible, and easy for God; and queens and kings are venerated) is not 'cancelled' or 'forbidden' by the fact that pagans previously, or before that point, gave the same title or honorific or role to a false deity. E.g. if pagans viewed a particular god (like Baal, which means Lord) as Lord, it doesn't mean there is not a true lord (God or man), just that pagans used the same title or honorific for their false deity—stole it, or used it wrongly. Pagans getting to 'copyright' certain dates or names for things and people or whatever else is just a ridiculous concept.
If Jeremiah wasn't speaking of the blessed virgin Mary, then it's just not relevant to discuss. And we know he wasn't because the virgin Mary didn't exist yet for another 640 years or so, but Jeremiah was speaking of something current in his day, and also of something concerning worship of a false deity, not the blessed woman Christians have always considered the greatest of the saints by virtue of being the mother of not only the Messiah, but the Messiah who was and is God, and of whom she was and is the mother to this day.
Consider an analogy. Imagine there was a pagan deity pagans called "the King of Heaven." It's almost impossible none such false deity was worshiped under this title. Does God approve of that false deity? I'd like to think so. And yet how is God still the King of Heaven? He is because He actually is, and this false deity is not.
It's very simple, really.