Improving the game's codebase isn't opposed at all, the problems come when codebase improvements are not followed up with proper documentation and/or aren't actually improvements. The best example I can think of for the latter in Civ5 is actually the SQL database used to store data. SQL commands definitely allow for much cleaner and more elegant alteration commands and make a mod's file structure much less of a jumbled mess. However, SQL assigns IDs to table entries when the table entries are added, so if a mod removes an entry from the middle of the table (e.g. removing an Industrial era unit or removing a policy), it also then has to reassign the ID of every single table entry following the removed one or face game-breaking bugs. If you want to remove several entries from all over the place in a table, it's often easier to just wipe a table clean and reconstruct it from scratch with those entries missing than to remove the individual entries... however, reconstructing the table makes it so that all changes to that table made by mods that were loaded before yours are thrown out as well, so that's a problem.
Proper documentation, on the other hand, is not something that should be ever disregarded. Even if a game is made without any official mod support at all, it is an extremely good idea for the developers to properly document their game's code, otherwise the developers themselves could get lost and pull things like they did in Civ5 where you'd have 2-3 different functions that are all supposed to do the same thing, but are in different sections of the code written by different people at different times (specific case I'm thinking of is research cost modifiers). If a developer already has proper documentation, then sharing it with the modding community requires no effort.
It doesn't matter whether access to the DLL source code is a right or a privilege, if it was offered in Civ4 from the very start but held back in Civ5, you can easily see why Civ4 modders would not want to move to Civ5. If this happens again in Civ6, you will again find that a lot of Civ5 modders will not want to move onto Civ6, though I guess that pool is much smaller because there are a lot fewer active DLL modders for Civ5 than there were for Civ4. Soren Johnsen talked about how much he had to talk with Firaxis' legal team just to get DLL source code released for Civ4, and it ended up not only not impacting the game's sales, but also allowed Firaxis to release official mods in the game's second expansion, BtS. All this considered means that legal should not have an issue with a DLL source code release. Technical guidance is unnecessary because if the source code is already well-documented, and it should be even if it's for internal use only (for reasons outlined above), modders don't necessarily need anything else to fiddle with the DLL.
The main reason therefore to not release DLL source code immediately is due to marketing and DLC strategies... and that's when things get finicky. If Firaxis releases DLL source code immediately, they help the modding community build better mods faster, which sells more copies of Civ6 (because mods sell games). In addition, by the time it comes to make Civ6's second expansion, they could also then pull a Beyond the Sword and invite some of the now-experienced modding community to make a couple of official, significant overhaul mods that they'd release with the expansion (like a Final Frontier or Ryse and Fall equivalent), and this would only be possible if the modding community has access to the DLL source code long enough to get experienced enough with overhaul modding the game within 3 years of its release. If Firaxis does not release DLL source code immediately, then they maintain a monopoly over a significant amount of mod effects, allowing them to sell DLC and expansions that use those effects without worrying about people potentially not buying those bits of DLC because a free mod would do it better. I obviously think that immediate release's upsides are much better, especially since people will still buy paid DLC for the art/assets alone even if a free mod exists with the same effect, but Firaxis might not agree, and that worries me.