I'd initially thought they were parasites, like Megatron had an infection or something from his open wound. They'd been described as spiders crawling in and out of his head on some occasion. But when I saw they looked like the Doctor, I thought maybe they were trying to repair him? But then why would he squish one?
Yeah there's a bunch of them, and they're just scurrying around on his head. At one point, one stops to try and weld something, so I'm assuming they're trying to fix his wounds. Why he keeps squishing them? If they've been at that wound since ROTF they're pretty shitty doctors indeed. I guess it's just his way of releasing frustration.
When Carly is talking to Megatron and Megs says its his world, one of the little doc spiders say "Yeah his."
'cause they are like lices?, I dunno, but that part made me laugh (... I was the only one laughing as an idiot at that part )