There are some components of rocketry that deserve careful consideration in sharing (i.e. rocket fuels) but a lot of those have mostly leaked at this point and the government has other reasons to limit their production and thus limits the supply of chemical components.
Much like with software there are going to be some secret components related to communication and the like - but those can be cherry picked from the information and deliberately hidden... similar to how most software teams don't check all their private SSH keys into public repos (usually).
I think government/ bureaucracy moves slowly and most people working within them don't come from a software background so a lot of the older norms of not sharing things (outside of things like data/documents) is just the way things are done. I expect to a lot of these people sharing a source code is treated exactly the same as sharing any other mechanical designs which they just often don't do.
Hopefully both things will change.
Elon had to go to Russia to get rocket plans. We have truly dropped the ball on this.