Ramana Maharshi is very recent. So of course Adi Shankaracharya used it much before.
But, noone coined the term. The term has scriptural basis.
In the Brihadaranyaka Upanishad (2.4.5)
आत्मा वा अरे द्रष्टव्यः श्रोतव्यो मन्तव्यो निदिध्यासितव्यो
मैत्रेयि,
आत्मनो वा अरे दर्शनेन श्रवणेन मत्या विज्ञानेनेदं सर्वं
विदितम् ॥ २.४.५ ॥
The Self, my dear Maitreyī, should be realised—should be heard of,
reflected on and meditated upon. By the realisation of the Self, my
dear, through hearing, reflection and meditation, all this is known.
Adi Sankara's commentary-
Therefore ‘the Self, my dear Maitreyī, should he realised, is worthy
of realisation, or should be made the object of realisation. It should
first be heard of from a teacher and from the scriptures, then
reflected on through reasoning, and then steadfastly meditated upon.’ Thus only is It realised—when these means, viz. hearing, reflection and meditation, have been gone through. When these three are combined, then only true realisation of the unity of Brahman is accomplished, not otherwise—by hearing alone.
Regarding the apparent sameness & differences -
Quoting from this book - The Method Of The Vedanta A Critical Account Of The Advaita Tradition by Swami Satchidanandendra (Translated by A.J. Alston)
Chapter 3.
It has been explained how the monk who has attained through
dispassion to genuine adoption of the life of wandering mendicancy
must necessarily carry out the discipline of hearing the texts and
pondering over them regularly and continually until he gains
immediate vision of the Self, He who does not attain this immediate
vision merely from hearing, must carry out further regular hearing,
supported by pondering over the meaning. Weak and mediocre
candidates,'however, must also perform sustained meditation
(nididhyasana, cp. T.N. at M.V, 53, intro.).
Sustained meditation, like the unbroken meditation implied in the
prescribed symbolic meditations, is a piece of action. Hence it is
sometimes called meditation (upasana). Yet such symbolic meditations
as 'Woman is the sacrificial fire' (Chand.V.viii.l) are differently
defined.
Upasana (as contrasted with nididhyasana) means maintaining a stream of identical images of which the form is (not dictated by one's
knowledge of any reality but) prescribed in the Veda. Nididhyāsana, on
the other hand, means fixing the mental gaze on the principle of
reality to determine its true nature, like one examining a Jewel.
A candidate practising meditation in the form of upasana must select
one of the meditations laid down for attaining to the Lord as
associated with attributes, and maintain the same image in his mind,
according to the dictates of the Veda, until he has obtained
immediate vision of the object of his meditation. For meditation
realizes its true end when it is used as a means to direct vision.
But its reward is attainment of the Absolute in its lower form at a
later time (i.e. after death) in the World of Brahma. Here there is
enjoyment of the same experience as the Lord. And at the end of the
world-period the final metaphysical knowledge will arise, and there
will be deferred release in company with Brahma. Such is the teaching
of the Veda.
The aim of the one practising sustained meditation (nididhyasana)
is different. He tries to attain direct vision of reality (here in
this very world) by turning his mind away from all else. And there is
the difference — as against upasana — that after the rise of
knowledge nothing further remains to be done. It is this sustained
meditation that is referred to at Katha Upanishad I.ii.l2 by the name
'Adhyatma Yoga’. In the Gita it is sometimes called ’Dhyana Yoga'
(e.g. XVI11.52). In the Mandukya Karikas it is called ’restraint of
the mind’ (G.K.III.41, etc.). Its nature is described there in that
latter work. Everywhere its result is described in the same way as
right metaphysical knowledge, and from this comes immediate
liberation (sadyo-mukti).
So basically, it looks like that Nididhyāsana is the precursor practise to that of the Patanjali's Samādhi.
Further,
Chapter 7.
124. Point 6
Awakening to immediate knowledge of the supreme Self depending on no external factor is called Nididhyasana. It is
mentioned after seeing and heairing to show that they culminate
in that.... One's first knowledge of the Self is through
hearing, and then one ponders over what one has heard. When
heauring and pondering are complete, one comes to have immediate knowledge of the Self....
Because the use of the word
'Nididhyasana' (lit. 'sustained meditation') might lead the
hearer to suppose that meditation was meant, the Upanishad
deliberately uses the term 'immediate intuition' (vijnana) as
a synonym for it at Brhadaranyaka (2.4.5) to show that meditation is not here meant. I already mentioned earlier how
meditation amd other practices are a means to immediate experience. But immediate exprience does not exist for the
sake of anything else. It is taught to be just liberation
attainment of the final goal of all. (B.B.V. II.iv.217 9 220,
233-U).
Chapter 8
154. Point 6
Sustained meditation (nididhyasana) means fixing the mind on the
content of the metaphysical texts of the Veda as supported and
mediated by pondering. Nididhyasana cannot here mean dhyana in the
sense of upasana, for the practice of enjoined meditations for karmic
merit would be useless in the present context (cp. B.Sid. p.l5^j
M.V,'98,1,; ad fin,). In the text 'The Self should be seen*
(B^‘had.II.iv.5)» the 'seeing of the Self refers (not to an act
performed in response to a command but) to immediate awareness of the
unity and sole reality of massed Consciousness, bereft of all
manifestations of plurality, arising as a result of having fixed the
attention on the content of the metaphysical texts.
Chapter 12
259. Point 16
In Sri Sankara's Commentary on Gaudapada's Karikas the term
'nididhyasana' (sustained meditation) is interpreted as a synonym for restraint of the mind, practised by the middling class
of students to achieve the dissolution of the mind into the
Self.
Thus, the Shankaracharya's definition of Nididhyāsana is implied for the weak-minded practitioner, as an intermeditate to the Nirvikalpa-Samādhi.
As regards -
"If its contemplation, then how does constant deep thinking gives a person moksha from cycle of rebirth?"
The answer is in the Brihadaranyaka Upanishad, quoted in the begining -
To paraphrase -
The Self comes to be seen through the disciplines of hearing, pon¬
dering and sustained meditation resolutely pursued. Right knowledge
of the Absolute as the sole reality only dawns when these three
disciplines of hearing, pondering and sustained meditation are fused
into one, and not otherwise, for example through hearing alone'
(Brhad Up 2.4.5).
So, it's a step by step ladder, and doesn't happen suddenly, by just following one of step.
P.S. Your last part of the question, should be a standalone question in itself.