I used an LLM to help me do the math but it appears you would have to make $1.5 million/year at "tech company" if you were to save 20% of your income and have $4 million saved after 10 years. That $4mm saved would allow you to appreciate to $5mm to retire on after 20 years while simultaneously withdrawing $150,000/year in passive income to live on.
Of course you can adjust this based on how aggressively you save, how much you need to withdraw each year, and how much runway you have until retirement and how much retirement you need to be comfortable.
Regardless, what you're suggesting is available only to the privileged few who can get extremely high-paying jobs early in their careers and hold onto them while having low enough expenses and high enough discipline to save aggressively.
OP's approach is a very doable path for folks who aren't so fortunate and/or young, but can code, have some life experience, and don't want to go get another job.