Nope. the first '지' is noun (Bound noun: 의존 명사). but, the second '지' is Ending of a Word(어미). Those are not of the same origin. So you should space out the words(온(verb) V 지(bound noun)) in the first case. But you should not in the second. (오래되지(verb)/ 묻지(verb))