Changing industries and stacks is massively difficult if you're doing it for getting a new job and not just for a hobby as most employers won't value your previous experience if it's not needed, so all that is just useless baggage now rather than an asset.
I tried going from algos/embedded SW development to backend/devops and it took me almost a year of rejections despite my best efforts to self study(in Europe).
Yeah, be careful into which stack/domain you pigeonhole yourself into as, depending on the market you're in, it might not be easy to change course later despite you being a skilled generalist. Not every employer will have the time and resources to verify or value your general skill set and will instead focus on going for sure-hires who better match their specific tech stack.
I recall one agency had a tagline "specialization is for insects" but the reality I've found for applying is a number of tech teams have pretty rigid requirements of x years experience with specific languages/libraries and won't consider what other valuable assets you bring to the table or how fast you're able to pick up material. Which I guess makes sense for senior level positions but junior/intermediate?
But eventually you finally get over the hurdle and it starts to click. I've done it a few times, and each time I have to remind myself that I've done it before and I can get through it.
Fortunately, so much of being an effective senior engineer is not about programming. But it's hard to remind myself of that when I feel like a "bad" programmer in a new stack for a while.