No loyalty to employers is completely reasonable. But you're RARELY the only one who hates their shit job. Establishing some favours and a friendly relationship with other people who hate your employer is easy and a good idea.
I tell people all the time about an employer a few years ago who I called out for being the most unprofessional, disrespectful, assanine bucket of cunts I've ever worked for. When I give references for that job, I give the contact information for my boss at that job who hated our management and HR department as much as I did and who I got on well with while I worked there.
My worst terms departure before that was a company that ran out of cash during the GFC and fucked over a bunch of staff with positive drug tests - everyone who popped positive was by remarkable coincidence, on a contract that didn't allow for appeal or re-test, and they destroyed the samples after firing us because our contracts left that loophole. I had maybe a dozen coworkers get in touch with me in the weeks afterward telling me that everyone with a contract like mine had apparently tested positive for opiates with no idea how that could have happened, and most of those coworkers offered to give me a reference.