Is comparative advantage only beneficial with convex utility functions?
What traditionally matters is a quasiconcave utility function (that is, the individual/country at least weakly prefers mixing such that all better sets are convex). I assume that's what you're referring to when you describe the Cobb-Douglass example.

Though I believe your comment about the functional form of utility is overall correct. If, for example, the utility function were
$$
u(x_{1},x_{2})=\max\{x_{1},x_{2}\}
$$
both countries would produce whatever they were more productive in, and neither country would be incentivized to trade.

(But again, I think the key is quasiconcavity of the utility functions, not convexity.)