The readfile shortcode was added because this sort of code inclusion was used previously and when converting the documentation I needed something with similar semantic. Another advantage is that it allows me to have a compilable code examples that can be easily downloaded using gitlab support for creating zip from directories[0].
More interesting are the doxysnippet shortcode[1] that provides the extraction from the source code or the custom rendering of links[2] that allows this sort of markdown links: [Overlay](docs:kirigami2;OverlayDrawer)