The answers probably differ depending on situation, but for me (flying J and having AY+ as main program) I look for codeshares only on routes where no AY flights are present. Like you said, this is due to earnings since a codeshare will earn twice as much (250%) as a OW partner coded flight (125%)
On routes where there are AY flights, I normally stay away from codeshares as I can't redeem on non-AY-metal. If a codeshare is cheaper and/or better, like on HEL-NRT (AY5811 = JL B788), I'd go for that. But then again, it is not the codeshare itself I'm looking for.
For someone flying Y and/or not crediting to AY+ I guess it can be the opposite.
As for OTAs, I have previously avoided them, but with AY's renewed price policy, I have changed my mind. I'm not paying a 10% premium for the delights of using AY webpages. Besides, OTAs offers connections AY won't sell at all. I may come to regret this during irrop, but then again AY hasn't been very good either.
Also, Expedia told me they are only an intermediary for Finnair. They called themselves "a frontend" or something like that, indicating that they are not actually involved. And infact, they don't even charge my creditcard - Finnair does.