You're not wrong. Certainly people think "well, there must have been a reason you were let go..." and yeah, sometimes it may mean you were stackranked out. With smaller companies that's probably harder to do, or... there are bigger factors at play (more immediate cashflow in our situation).
And yes, always be looking.
Also, there's the whole long-standing goal among managers to keep their head-counts as high as possible. Managers also don't want to become redundant, so, it makes sense to lay off the more expensive people as much as possible, to keep their headcounts high and avoid the unwelcome situation of having a team too small to justify their continued existence as managers.
And, of course, for morale, it is better to convince anyone left that they were left because they are the stars, not because of their low likelihood of looking elsewhere.
Positions are made redundant, not people. It doesn’t matter how good or bad you are if the company no longer has work for someone who does the thing you do, or in the location you do it.
Some unethical companies do use layoffs as a cover for stack ranking but that’s an easy ruse to see through and reflects on them, not you.
Again, obviously that doesn't always apply in all situations (e.g. the closure of an entire business unit, or the loss of a big customer), but it also obviously applies in many situations. Furthermore, since on HN we like to think that skills matter, wouldn't we want it to? I mean, if there is a fantastic developer that just happens to be on a project that gets cancelled, wouldn't you want the company to figure out how to keep them over someone who is much less productive working on a project that just happened to not get cancelled?
Which is why I'll repeat the advice: the best time to find a new job is when you've already got one. Layoffs very rarely come without any warning, so if things start to look even a little dicey, not a bad idea to at least put your resume out there.