Could my iPhone be installing malware on factory reset?
Yes, it is completely normal to see loading bars / progress while the phone reboots after a "factory reset". It is not a sign of malware being installed.

Perhaps your suspicion is because your phone is managed - i.e. owned and controlled by your employer, school, or similar?