Qantas has been on record stating that the many people flying to/from LHR are starting/stopping in PER, so I'm not surprised that the majority of QF9 pax on the MEL-PER leg are actually domestic.
You have to clear customs in either direction if you're just taking the domestic leg (QF9 or QF10), but if you're a domestic passenger you don't need a passport. Just some form of ID. Not sure why that's controversial?
As for customs. Yep, you're absolutely spot on. Perth Customs just couldn't be bothered. I'm sure they were all sitting on the other side of the office door just playing cards instead of possibly working on the other side of the airport where the majority of international traffic in Perth is processed, and when QF9 was going to be early then scrambling to get available officers across to Qantas' special terminal.
As an opposite anecdote, I've used QF10 and QF9 domestically a few times mostly without issue. The Melbourne customs hall can sometimes be a bit of chaos, but overall I've had good experiences. I actually look to book these (and the QF5/6 equivalents with SYD) when I can.