By "replaced", I meant "filled the gap", "substituted", along those lines.
The state militias went away. The states are free to bring them back.
Great. Then the substitute must be necessary to the security of a free State. For that reason, the right of the people to keep and bear arms shall not be infringed.
Please tell me how you became convinced that the militia mentioned in the Second Amendment is a state militia? Why can't it be a territorial militia? Or a federal militia?