TBH both of my kids have done this - and both have gone right back to sleeping more sensibly as soon as they are better.
Talking about how we all go to sleep in our own beds helps though - before they event. Like where does the dog sleep? In his basket!! Where does Megan sleep? In her cot!! Where does Jacob sleep?? In his bed all by himself!
We have the same after a sleep in my bed due to illness. I cheat here a bit as it is much darker in my room than his, and he hates the dark, so I let him in and then after a few mins ask him if he likes his room better, which he does and then he chooses to go back
.
I think he is likely being clingy because he feels poorly, and I wouldn't worry too much.