From my experience being in tech over 20 years (from my high school days until now) Large companies that aren't growing do this all the time.
IBM, Verizon, AT&T, HP, etc all would hire in new areas and at the same time 'dissolve' old divisions. Sometimes the 'laid off' folks could scramble to find new teams.
The growing FAANG companies would rarely do this on as large of a scale, but it did happen, teams would be dissolved and sometimes every employee would have to find a new position internally or get laid off. For growing companies there are usually so many open spots on other teams, that it's less of a risk.
For companies that aren't growing rapidly, this often means lots of people get laid off.
>That is, should we frown upon people who leave after a few weeks of joinig a company because they got a much better offer
Business is often not solely a 'morally correct' thing or not. Sure it's not morally wrong to be a mercenary, but it may rub people the wrong way. If some manager fights to get you on their team, spends time onboarding you, then you leave for a slightly better offer, they will remember that.
Conversely, Iv'e worked for people who were very happy for me when I 'graduated' to larger and more impressive companies, and no hard feelings were had.