Clearly this is one of those scenarios where the base rules for combat don't work very well. That means you need to get back to that whole "The DM tells you the situation, you say what your character does, the DM tells you what happens next" cycle. So what happens exactly pretty much depends on what the DM feels would make most sense.
We've established that there's enough room on the carpet for 2 (or 4) people to sit peacefully. So outside of combat, there can be 2 (or more) people. We've also established that for proper fighting, a character needs 5ft×5ft of space.
That means two characters sharing a carpet, coming to blows, cannot fight properly. So the DM would need to make some calls, based on the situation. Which might not even involve rolling initiative.
Here's what I might do in some potential situations:
2 people on the carpet start fighting
Since there's no room for anyone to properly stand up and fight, this is basically a struggle for space and shoving the other person off the carpet. In this case, I'd ask for opposed Strength(Athletics) or Dexterity(Acrobatics) checks, player's choice, and whichever player gets the highest roll either pushes the other off the carpet or grapples/pins them down, whichever they want. There's no room to swing a sword, cast a spell, or any other fancy tricks. It's just a quick, raw, physical struggle to see who comes out on top.
More than 2 people start fighting
Lets say you have 4 Halflings on your carpet and they get into a fight. Resolution would be fairly similar; everyone rolls Strength(Athletics) or Dexterity(Acrobatics) and whoever gets the highest, is last Halfling standing, the rest is shoved off the carpet.
If there's a situation of two groups fighting, you might adapt the ruling to say that any characters who roll higher than all enemies stay on the carpet, so if A and B fight C and D and the roll come out A(12) B(11) C(8) D(5) then both A and B will remain on the carpet together, but if the rolls come out A(15) C(13) B(11) D(8) then only A will stay behind and B is shoved off by C.
2 people on the carpet are threatened by an outside force
If you're flying the carpet with a friend and a Giant Eagle decides you look like a snack, then the fight isn't happening on the carpet. This is the only situation where I'd ask for an initiative roll and start a normal combat.
In this situation, you need to make a DM call. It makes sense to just say "there's no room to fight properly, you both fall off." This rule requires the threat to be serious, if an angry pigeon attacks the carpet, having people fall off isn't fun. I'd probably also warn the player beforehand of the risks of flying a carpet, so they can maybe take some precautions.
You might also decide that two people being friendly to each other can try to cope with the situation as best they can. For example stating that both characters are Prone and Squeezing to stay on the carpet might work. That'll represent the uncomfortable position they are in, but doesn't instantly end the fight because both people fall to their deaths.
The carpet as a combat platform
I'd be wary about allowing even a single character on a carpet to fight normally. The carpet is not a mount, it's a small piece of cloth that you verbally tell roughly where to go. You won't have proper footing and it might even bend or fold as you step around on it. Even if you're alone, I'd probably assign penalties when fighting from it. That's just not what it was made to do.