[Git][ghc/ghc][wip/spj-apporv-Oct24] refactor building CtOrigin before instantiations as a function