No. When Charlemagne was crowned Emperor by the Pope .... Now, the Pope might not have had any legal power to gift the imperial throne to whomever he wished...
Hm, the Pope did not have any power to give the title of Emperor. At all.
But on the other hand legally anyone on the Roman soil could claim the title of Emperor. And anyone definitely could proclaim anyone the Roman Emperor.
So the Pope and Charlemagne did not do anything wrong.
Charlemagne got too much power and too much lands and he obviously looked for suitable title. What choice did he have?
If he was close to Persia he might try a title of shahinshah. If he was closer to the Avars or the Khazars he would try on the title of Khagan.
But he happened to be closer to Bysantium and his peoples still kept memory of great Roman Emperors of the past. So he became the Roman Emperor. And the Pope just got handy for this occasion.
The choice of the title is always quite interesting. Let's take first Rurikid rulers of the Kievan Rus. When the Rurikid ruler got too important he started to look for a suitable title. First Rurikids called themselves Khagan as that was the title of the Great Khazar Empire and their subject Slavs had been under rule of various Khagans of the Avars and the like.
But it did not stick as the Turkic influence faded away especially after the defeat of the Khazar Khaganate.
Some of the Grand Princes even called themselves Caesar at home, but it did not stick as well as the Byzantines were too important as trade partners and they did not like the Barbarians using the Roman title.
So the Rurikids went on using an old Slavic title "Knyaz" (Prince) as it was the best known comprehensible to the majority of their Slavic-speaking population.