Hey there, I have been experimenting on this topic quite heavily lately. I have managed to create a kingdom without any issue. Kingdom is functioning %100. No problems. You can invite other lords, declare wars, etc so if you are looking for a reference you can check out my mods's source code hosted on GitHub.
A mod which lets you create your own kingdom for the game Mount & Blade 2 Bannerlord - EmreBugday99/Kingdom-Creator-For-Bannerlord
github.com
I will also be updating this github repo as I update my mod itself so that everyone can get an up to date references on how to dynamically create kingdoms.
This mod is not currently available
www.nexusmods.com
Only issue here is;
After the new beta patch game crashes after 5-6 minutes with the mod enabled. I couldn't find out the issue really. This seems to be the only problem stopping us, modding community, from dynamically creating kingdoms. This is the error I am getting
Image Untitled hosted in ImgBB
ibb.co
Edit: My idea is that, which is just a guess;
Now I am not using any arrays on my code so this is purely related to the integration of the mod itself to the game code. Somewhere in the code base; game has an array of kingdoms(as i said above, THIS IS JUST A GUESS.) and this array is probably being initialized from some xml file. Mod creating a new kingdom might be causing some issues because arrays can not be appended. I am not sure at this at all as this is just a guess BUT this shouldn't be the case since storing kingdoms in an array doesn't make any sense from a developer perspective. It destroys the entire dynamic power of the system. Arrays should be used only when you are %100 sure that you don't need to append and in a game where you emphasize a lot on modding creating one of the most important aspects of your game in a non appendable way does not make any sense. Therefore, this is why I believe that this is not the cause of the issue but also this is the only reason I can think of atm.
What do you lads/ladies think about this issue?