Tl;dr, We should have a non adhoc way to design collapsibleFooter so MediaWiki and its extensions can append to it without difference, or simply use HTML5's <summary> <details> throwing away all JS logics and Less icons and so, make it work even when client doesn't have JS
Backstory:
Somehow I reached to T351681, I liked to see if that's something I can work on my spare time so went for this change, https://gerrit.wikimedia.org/r/1062456 removal of mediawiki.icon from one last place in core itself.
I knew the solution wasn't perfect as it was injecting an icon to messages paragraph, but as there was margin collapse going on (that paragraph had a margin that was shared with other elements on the page) so in order to keep the change both minimal and visually identical while getting rid of the mediawiki.icon module I went for it specially because codex icons are meant to be placed in their own element, at least that's something I learnt from @TheDJ, it seemed good enough to me.
I was done with the amount I wanted to progress the task voluntarily but suddenly I found out my change caused breakage in Wikibase,
(note the first section's triangle)
So I felt that's my responsibility to fix the regression so I went for https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/1065246 . But the fact it broke like this even without touching anything on mediawiki.icon itself yet made me think this was using an already adhoc solution that needed some redesign, it copies some part of Core's collapsibleFooter but reuses some other parts which is why it broke. It should've been either completely independent, no shared class, or something completely shared with Core's logic without duplicated JS/Less logic and marking 'mediawiki.action.edit.collapsibleFooter' module an explicit dependency of Wikibase.
And later I learnt it's still not perfect, @Od1n found two other issues in my work https://phabricator.wikimedia.org/T351681#10090321 so I went for fixing them as well https://gerrit.wikimedia.org/r/1066438 but I don't see the solution being perfect either as noted why there, just that it fixes the regressions, and to sync Wikibase with that change I uploaded https://gerrit.wikimedia.org/r/c/mediawiki/extensions/Wikibase/+/1066441 also, which didn't matter but I liked to keep them in sync. And then there was another glitch on that regression fix, T373658
Even LivePreview can cause the icon injection to be ran twice which shows something has went wrong but even before my changes.
And now after all these I felt more and more this should be improved, the whole thing undoubtedly not something important, not something regular readers would care about, so let's either use <summary> <details> there, or, have someway to not duplicate the logic in Wikibase extension or any other place that might use this in future, perhaps JsonConfig can be it's client later also like T371300. And perhaps it can get a nicer icon and animation along the way.
Thanks