Here are a couple more realistic options to consider:
1) If you're not born in India or China, prioritize landing a job at a stable employee-friendly company that is willing to start your green card petition asap. Stay there till you get your green card. If things go smoothly, it should only take ~2 years
2) If you're born in India or China, live extremely frugally throughout your 20s and save up as much money as you possibly can. Worst case scenario: use your savings and supplement with personal loans to apply for a EB5 visa (costs about $800k)
3) Apply for permanent residency in places like Canada/Australia/NZ. If you're a FANG caliber developer, you'll be welcomed with open arms in most countries besides USA. You'll most likely take a big hit to your compensation, and being forced to move countries is never fun, but at least your life would be somewhat similar to living in USA