I don’t think it cleans them every time, cos there’s a separate cleaning cycle. But even if it were, that should just be moving the head over to the sponge and giving it a squirt. No idea what the restof the clacking and whirring is for.
Likely to be calibrating things, like the carriage, plus some cleaning. Lots of noise because it uses the same motor for lots of functions, so lots of gears and linkages.
If you really want to know, look up some HP patents, there’s a few.