"Does the lender have a time limit to repossess the house before s/he loses the house as security"
It depends on the circumstances.
If a person acquires a right under a contract, for example, the right to foreclose on a mortgage, then they do not have to avail themselves of that right immediately or at all.
In general, waiving a right does not create a general waiver - if you give me a foreclosure trigger now that I waive, I can act on a foreclosure trigger that you give me latter - most contracts spell this out specifically.
However, if we establish a pattern of behaviour where you arrive at the reasonable assumption that I will never foreclose then I may find myself estopped from doing so. This is a creature of the circumstances; for example, if I wrote to you each time you were in arrears saying that if you did X and Y then I would not foreclose but reserving my rights on future arrears then this may be enough to prevent estoppel. If I do it half a dozen times in 2 years though, it might be reasonable for you to think I will always do it.
Of course, we can also vary the terms of the contract explicitly by agreeing to whatever we like.
... especially if there are "Junior" mortgages behind it?
This probably doesn't change things between the first mortgagee and the mortgager, however, if the (in)actions of the first mortgagee reduce or eliminate the rights of secondary mortgagees then the first mortgagee may be open to a damages claim from them.
Is the loan "impaired" in any way for the new buyer?
If it is "impaired" then it would be "impaired" no matter who owned it. If this was not disclosed when it was sold the seller may be open to a claim for damages.
does the new buyer who bought a "non-performing" loan retain the security in the house?
Maybe, see above.