You can add the language switcher with the shortcode system see documentation here
I know, I read the documentation and did tests before to write my opinion. On WordPress 6.3.1 and Twenty Twenty-Three theme your shortcode outputs language switcher HTML code as the very first tags of the page, exactly before
<!DOCTYPE html><html lang="en-US">...
It doesn’t matter in which position of theme template shortcode is placed. Browser shows it anyway in topleft corner of the site, but it’s impossible to position it correctly in this case. I think you never tested your display_switcher() method in block themes.
Anyway, thanks for the answer.