Get real. If this were so American tech workers would not be loudly complaining about the HB1 program. They would all be hired ahead of HB1 workers
In fact many American techies are out of work precisely because there are HB1s flooding the job market, stealing their jobs by undercutting them on price. Willing to work cheaper.
What you appear to be saying is that currently working H1B workers should be replaced by laid-off American workers. That would make sense if the reasons for lay-offs were ignored. Even in the best of times one of company managements major tasks is to be prepared for reductions in force. In a normal downturn, lay-offs are used to cull under performers no matter what their status and all managers keep a "cull list" of the bottom 20% of their direct reports. That list is continually updated and has nothing at all to do with the citizenship or lack thereof of that group. It is however, only human for those that have been placed in the bottom 20% of performers to look for a scapegoat instead of the fact that they have been coasting through the good times and are let go with the bad times. When, as in the case of IT, the bottom drops out and the lay-offs go beyond the cull list then the managers have to make harder decisions regarding who goes and who stays since after the deadwood is gone you are now into the more productive people on the staff. However there is still no legal requirement to lay-off an H1B just to save the job of a citizen. All things being equal as to qualifications of the citizen vs the H1B the citizen will be kept because it is more expensive to lay-off the H1B than the citizen but law does not require it. The law only requires that when there are two qualified new Applicants for a job, one a citizen and the other an H1B, the citizen gets the job.