I’m having the exact same issue, and I haven’t been having it at all until just now. I was playing when I got kicked off, then the server said invalid login session, then when I closed and reopened, it said it couldn’t connect to Minecraft services and the play button said play offline, and then I logged out and logged back in and now the button says play demo. If I go on the Mojang store it says I have the game and just need to download it.
I had the exact same thing happen to me yesterday. On Windows 7 (yeah, I know), but it's been fine for over a year, on the old launcher, re-installed, all that stuff. What I can tell you is that the old launcher currently and still works on my Win10 machine. Also, on my win 7 machine, an alternate launcher also works (MultiMC). Firewall and Antivirus do not seem to be blocking anything (disabled both to test), so I don't get what suddenly went wrong with the launcher.
So grab a copy of multiMC and install. I just created a 1.18.1 instance, added my MS account (it'll give you a code to grant access), pointed it at the java install that was literally in the old launcher's folders and started it up. This will download the game assets to a new folder. Copy your old saves, resource packs, and options.txt file to the new locations and good to go! This was very quick and dirty, tl;dr the manual. I'm sure there are better ways to configure that instance for example. Should also point it to a proper version of Java ( https://github.com/MultiMC/Launcher/wiki/Using-the-right-Java ). Also upped the default maximum memory allocation to 2GB. Kind of a hot mess, but it works!