Some technical notes on this case.
I think our CamelCase renderer tries to mimic the behaviour of the old C2 wiki, which was the source of the original camel case. According to the LinkPattern page, their matching expression is this:
As you can see, this is a very limited regular expression that only works for Latin letters in the ASCII range and doesn't support numbers or other languages like Confluence does.
In Perl, this regex works the way described in the comments above with regard to underscores, skipping words completely that contain underscores:
In Confluence, the CamelCaseLinkRendererComponent has the following pattern, which supports Unicode so it's a little bit harder to read:
This has some special handling at the start around certain characters, but doesn't have any 'terminating character' matching or require a \b "word break" at the start or end. Adding \b at the end helps with breaking when we get to an underscore but we should test its behaviour with non-ASCII letter characters that should be part of the camel case link (so, for example, GrandesÉcoles should continue to link properly).
Adding a negative lookahead just for underscore at the end also causes our pattern to backtrack.
So in ends up converting CamelCase_WithUnderscore into CamelCase_WithUnderscore, which is clearly wrong. So we need to have a negative lookahead that includes letters, underscore and the end of input/line.
Simply adding underscore as a character that could not appear at the end of a CamelCase link also breaks CamelCase links in italic phrases, because _LinksLikeThis_ would not work as links because the CamelCase processing happens before the italic phrase processing. So we need to move the CamelCase renderer component after the phrase renderers and see whether that breaks anything.
Finally, CamelCase rendering is not the most well-tested feature in Confluence, so any change to it risks breaking stuff that is completely untested. I'm hesitant to make such a significant change to it on a bug fix release.
In fact, with further testing I see that it does. Anything that inserts a token in the output (such as the HTML entity or backslash handling) will end up breaking CamelCase links by changing their text – and therefore their destination! – before the CamelCase link renderer runs.
Here's what the CamelCase renderer sees when a token appears within a CamelCase word, which it interprets as a valid CamelCase link:
It also seems to break the behaviour of embedded images inside text (e.g. Some!...!text) for some reason I don't fully understand.
So this is going to be closed as 'Won't Fix':
Basically, the difficulty and risk of fixing it greatly outweighs the benefit of solving this particular problem with CamelCase links. Sorry for taking so long to reach this decision.