There is a middle ground between getting a company logo tattoo on one hand and on the other being a clock puncher, who fulfills the minimum job requirements and begrudges any request to put in extra effort.
It's possible, even admirable, to be diligent and take pride in one's work for reasons other than drinking the company kool-aid. It's possible to be diligent and work hard, and still leave if you are mistreated.
Yes, employment is inherently transactional, but for jobs like software engineering, machine learning engineering and other high education jobs, the aggregate of the transaction is much closer to a year of work than an hour or day of work. Also, the terms of the transaction often include a variable bonus for performance, as judged by the employer. It seems reasonable to incent people to work harder by offering more compensation in return. It's up to everyone to decide whether the terms of the transaction work for them, but there isn't One True Way™ for everyone regarding company loyalty.
It's also possible to be loyal to the people you work with--even your boss, if she merits it--without being loyal to The Company. I've worked in great teams in companies that have a reputation for being shitty employers. In one case, that didn't stop me from leaving because the job wasn't the right fit for my family and my wife was unhappy. I felt somewhat bad about leaving, but I still left.
Mixed feelings are okay.