I would argue that I am flexible but that comes at a cost, low specialization.
My question: To build a career, how much do tech stacks matter? Should I stick to one (React, FastAPI, PostgreSQL) or doesn't it really matter as long as I can ship something? Is it fine to use Svelte for a new project when breaking into the market or should I stick to React?
Note: I worked in different roles not described as SWE but in practice I am writing code full time for almost 3 years. Building a career refers to "becoming officially a SWE".
Tech stacks come and go every few years (5 years is a pretty good run for a framework / stack), careers last 20-40 years.
You're going to need to develop skills outside the tech stack that are generally useful and have a longer half-life (like debugging, SQL, shell scripting, source code management), and also proactively switch to a new stack every now and then.
Re: how important stacks and specialization is, that really depends on the hiring manager and the culture of the company you're applying to. Generally speaking though, it shouldn't be overly important for more junior roles.
The intersection of software and domain expertise is highly prized. So it takes chips off the table on whichever bet you make around tech stacks.