These kinds of conversions seem to be becoming more common. There's a handful on youtube using older Intel iMac guts and it should be doable with an iMac G5 as well.
In general, internal LCD connectors speak protocols that are standardized enough that you can buy adapters or converters to accept HDMI or DisplayPort input. Then, figure out how to trick the power supply into turning on to power the display.
Form there, you literally just slam an M1 mini (or its uncased guts) inside whatever it is you want to convert. Pair with cable extensions, use wifi and bluetooth and you don't even "need" to cleanly match up the ports on the back of the machine.
If un-cased, an Intel mini would probably have worked fine in an iMac G4 base, even the 2018+ high wattage ones, or the 2011/2012 models with Radeon graphics, which is kind of an indication to me they didn't even uncase the mini they put in. (or perhaps this person wanted to have a mini with no fan, which is not something Apple ever built, but the M1 mini should work fine that way.)