Before the Buddha introduced nirvana and enlightenment, was there any way to escape from the cycle of birth and death? What is written in Buddhist texts?
Some Buddhist texts say that there were previous Buddhas (and that there will be others in the distant future): that they too taught Buddhism; and that the current Buddha rediscovered Buddhism.
For example, in the commentary to Dhammapada verse 183:
On one occasion, Thera Ananda asked the Buddha whether the Fundamental Instructions to bhikkhus given by the preceding Buddhas were the same as those of the Buddha himself. To him the Buddha replied that the instructions given by all the Buddhas are as given in the following verses:
Then the Buddha spoke in verse as follows:
Not to do evil, to cultivate merit, to purify one's mind - this is the Teaching of the Buddhas.
The best moral practice is patience and forbearance; "Nibbana is Supreme", said the Buddhas. A bhikkhu does not harm others; one who harms others is not a bhikkhu.
Not to revile, not to do any harm, to practise restraint according to the Fundamental Instructions for the bhikkhus, to be moderate in taking food, to dwell in a secluded place, to devote oneself to higher concentration - this is the Teaching of the Buddhas.
There are even some suttas, such as SN 12.65 which implies that Nirvana and the path the Nirvana was "inhabited in ancient times" and rediscovered by the Buddha.
In the Nagara Sutta, the delightful ancient fortress city [§20.2] clearly refers to nirvana, and the city is populated by saints (called “seers,” rsi, in the Sanskrit Nagara Sutra, §5.28). Both the Pali and Sanskrit versions of the Sutta speak of ancient people using the path.
Texts also say that a few people (called "private Buddhas") discover Nirvana for themselves, but (unlike a true Buddha) aren't able or aren't willing to teach other people.
Because the Buddha discovered reality as it actually is, rather than coming up with a personalised conception of what it is, the Dhamma is open and discoverable to all, whether there is a Buddha to light the path or not.
Specifically within Buddhism there is a concept of Pratyekabuddha-hood, which are beings who discover the Dhamma without a teacher - without a living Buddha or his message being available. They do not teach though.
The Buddha was not the inventor of the Dhamma within Buddhism, he was 'only' an expounder of the Truths and the Eightfold Path. Before him there were past Buddhas within the Tripitaka, and a future one too (Maitreya).
Effectively the path is always discoverable and Nibbana achievable, to any individual willing to search.
According to Theravada tradition, Buddhas come and go over countless eons. Only in the times when their teaching is alive and true will we get a chance of escaping from this endless samsara. Every once in a great while, after a long period of spiritual darkness blankets the world, an individual is eventually born who, through his own efforts, rediscovers the long-forgotten path to Awakening and liberates himself once and for all from the long round of rebirth, thereby becoming an arahant ("worthy one," one who has fully realized Awakening).
In Digha Nikáya Sutta 14, Mahapadana Sutta (The Great Discourse on the Lineage)) & DN 32 The Ātaānātiiya Discourse, the Supreme Buddha stated that six Supreme Buddhas appeared over 91 world-cycles. The seven Buddhas, including "our" Supreme Buddha, mentioned in DN 14 & DN 32: Vipassi, Sikhi, Vessabhu, Kakusandha, Konagamana, Kassapa, and Gotama. They were all born in this earth, in the land of the Rose Apple (Jambudipa), in north-central India in the area known then as the Middle Land (Majjhima Desa).
If such a being lacks the requisite development of a Supreme Buddha, he is unable to articulate his discovery to others and is known as a "Silent" or "Private" Buddha (paccekabuddha). These silent Buddhas come to pass a few hundred years prior to a birth of a Supreme Buddha. These Silent Buddhas too are born only in the land of the Rose Apple (Jambudipa), in north-central India in the area known then as the Middle Land (Majjhima Desa). This is a Dharmatha - a set of natural laws.
Only at a time when the Dhamma of a Supreme Buddha is alive in the world will arahants walk this earth because they require a Buddha to show them the way to Awakening. (All Buddhas and paccekabuddhas are arahants) No matter how far and wide the sasana spreads, sooner or later it succumbs to the inexorable law of anicca (impermanence), and fades from memory. The world descends again into darkness, and the eons-long cycle repeats. The most recent Buddha was born Siddhattha Gotama in India in the sixth century BCE. He is the one we usually mean when we refer to "The Buddha."
The next Buddha due to appear is said to be Maitreya (Metteyya), a bodhisatta currently residing in the Tusita heavens. Legend has it that at some time in the far distant future, once the teachings of the current Buddha have long been forgotten, he will be reborn as a human being, rediscover the Four Noble Truths, and teach the Noble Eightfold Path once again. His name is mentioned only once in the entire Tipitaka, in the Cakkavatti-Sihanada Sutta (DN 26; The Lion's Roar on the Turning of the Wheel):
[The Buddha:] And in that time of the people with an eighty-thousand-year life-span, there will arise in the world a Blessed Lord, an arahant fully enlightened Buddha named Metteyya, endowed with wisdom and conduct, a Well-farer, Knower of the worlds, incomparable Trainer of men to be tamed, Teacher of gods and humans, enlightened and blessed, just as I am now.
According to Buddhism, there was no way to escape from samsara (the cycle of ignorance, craving & ego-becoming) before the Buddha.
What is called 'Hinduism' arose after Buddhism. Before Buddhism, the main religion was called 'Brahmanism', which focused on 'Brahma' (god) & the Brahmin caste. There appears to be no evidence Brahmanism found a way to be free from 'samsara'.
If Brahmanism actually knew of a way to be free from samsara, the word 'Buddha' is a lie & false, since the Buddha declared his discovery was something completely brand new, i.e., "never heard before".
This noble truth of the way leading to the cessation of suffering has been developed’: thus, bhikkhus, in regard to things unheard before, there arose in me vision, knowledge, wisdom, true knowledge, and light.