I have managed to make Template:CC-BY-SA appear on Category:Image wiki templates, so I mainly got what I wanted. But I had to use a workaround.
Before the workaround, just to clarify: The Category:Image wiki templates page says:
> To put a template in Category:Image wiki templates: Use
<includeonly>[[Category:Image wiki templates|{{PAGENAME}}]]</includeonly>
on the documentation page.
As I already stated in my question, the template *documentation* page (Template:CC-BY-SA/doc) already has that piece of code, but it had no effect. The way I understand MediaWiki, that code should have worked, but did not, which is surprising and why I asked this question.
The workaround: I have added
<noinclude>[[Category:Image wiki templates|{{PAGENAME}}]]</noinclude>
to the template page itself (Template:CC-BY-SA). Note that the workaround uses <noinclude> instead of <includeonly>.
Now Template:CC-BY-SA appears on the category page (Category:Image wiki templates).