That barrel extension gets torqued on the barrel at 175lb/ft. Not gonna be an around-the-house repair for it, and headspace needs to be checked after it's torqued back on there tight.
It might line back up, it might not.
Some people think that the index pin holds the extension on the barrel, but that's not the case. The index pin doesn't go into the threaded portion of the barrel, at all - only into the extension part.
When it all gets torqued back together, the fixed position of the index pin has to line up (centerline) with the barrel's gas port - if not, there's no fixing it. That's if headspace isn't way off.