No, it's not common practice for tech companies to immediately fire anyone who resigns.
A 2 week notice period is basically standard in the US tech industry. Some companies will take resignations and then remove the employee's access to sensitive material (code, chats, documentation, etc.) but require them to be available for 2 weeks to participate in handoff conversations. They continue to be paid, however.
It does happen that companies will immediately fired people. However, companies rarely do it because they stand to lose a lot of transition information and it also poisons the well for any future resignations. It also sets a precedent for remaining employees to not give any notice, which means everyone is going to start quitting without any notice in the future. This is bad, and companies want to avoid it.
Giving extremely long notice periods (e.g. "I plan to quit in a few months") could push the company to move up your departure date, though. The only time long departure notice is really warranted is for executives and truly key employees. Most people over-estimate their importance to their company and their project, IMO, but in some rare cases a single person can be instrumental to a company. It's nowhere near as common as people assume, though.
In practice, it's not really a huge loss even if it does happen. Most people get raises when they change jobs and the new company is often willing to move start dates up if you ask.