Not to mention, if living your ideals is an important part of your own utility function, then yeah - it can be best for you even if it comes with other compromises.
If you look at the individual level, with a purely rational 'Homo economicus' rational actor, ideals don't make a lot of sense.
It's so programmed in we think baby lions are cute.