If I understand, there are cases where flight time is considered compensation, affecting the legality of operations by private pilots. Can this be avoided by either not logging the time or somehow logging it differently (i.e. with a note saying "not to be counted for licensing purposes")?
Yes, this can be done by simply not logging the time.
The FAA has given an official interpretation regarding this issue, the "Lincoln-Soaring Society of America 1990 Legal Interpretation."
In this case, a private pilot wanted to tow banners and be reimbursed for the expenses of the flight. The interpretation says (to summarize) that doing so would ordinarily be prohibited because the flight time is compensation, but "[o]ne solution to this problem would be for private tow plane pilots not to log their time."
Thank you to @757toga for suggesting that I check FAA interpretations.