Re: in-universe logic for the Yonkou, there are four of them because that's what the new world can support as an ecosystem. The name isn't a group that was established and looked for members, it's a description of the current state of the world. I doubt the World Government actually coined the name, it was likely coined naturally by the people/pirates of the New World in response to how the balance of power ended up.
You've got four roughly-equal pirate factions vying for control of the New World, not necessarily in physical size of territory, but in overall military strength. When one group was weakened (Whitebeard after the Paramount War), it created a power vacuum. Conceivably the other three players could've expanded to fill that void, but Blackbeard made a concentrated effort and ended up creating a solid enough foothold to be considered the fourth emperor. There's no hard and fast reason why there couldn't just be the Sankou or the Gokou, depending on how the factions clashed and ended up.
Now the Shichibukai, to understand their makeup you have to consider the Three Great Powers, comprised of the Marine Headquarters, the Shichbukai, and the Yonkou. They exist in a delicate balance, and the status quo of pirates vs Marines is dependent on their makeup. Crocodile's deposement set the WG in a tizzy because the balance tipped away from the Marines/Shichibukai, thus their desire to quickly replace him. For one reason or another, they've decided that seven is the appropriate number of warlords that, when combined with the Marines, can keep the Yonkou counteracted. Not really actively, but you gotta think of them more like nuclear deterrents. Because the military force of the Shichibukai exists and can be called upon, the Yonkou don't have an overwhelming advantage should they choose to attack the Marines directly.
I can only speculate as to why the number is specifically seven and not some other number, but my guess is that seven is the balance between enough power to counter the Yonkou and not so much that they become too powerful and unmanageable, since they really are just pirates, and are prone to betrayal.