I applied your diff with a testing. This indeed solved the performance issue.
Will this be updated in Org-mode source code?
Also I come up with one thing, filter out tags which have shortcut keybinding bound. Because user defined shortcut key defined tags are not always on head of list.

[stardiviner]           <Hack this world!>      GPG key ID: 47C32433
IRC(freeenode): stardiviner                     Twitter:  @numbchild
Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433
Blog: http://stardiviner.github.io/


On Sat, May 13, 2023 at 3:39 PM Ihor Radchenko <yantar92@posteo.net> wrote:
stardiviner <numbchild@gmail.com> writes:

> I have a large `org-tag-alist` value that contains about ~7000 tags.
> When I press [C-c C-q] `org-set-tags-command`. Emacs suspends a long time.

Indeed. That's because `org-fast-tag-selection' tries to put all those
7k tags into tag selection window.

We can probably limit the maximum number of tags in the quick selection
window.

Can you try the attached simple diff for `org-fast-tag-selection' and
check if it is enough to solve the hang?


--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>