Prophet Zecharaiah Surah Maryam
According to Qur’an, Prophet Zechariah (AS) saw the blessings of Allah upon Hazrat Maryam (AS) and was inspired to ask for a child. So it is implied, he only started asking for a child after witnessing that, not his entire life as you speculated, only after seeing the provision in her chamber . Before that, he may not be interested but a desire came in his heart after a long time and he asked his Lord, despite having a barren wife and reached an old age, hoping for something and because worshipping Allah involves asking for whatever you desire so a prophet would be the likely person to worship Allah like this. So her Lord accepted her with good acceptance and caused her to grow in a good manner and put her in the care of Zechariah. Every time Zechariah entered upon her in the prayer chamber, he found with her provision. He said, “O Mary, from where is this [coming] to you?” She said, “It is from Allah . Indeed, Allah provides for whom He wills without account. At that, Zechariah called upon his Lord, saying, “My Lord, grant me from Yourself a good offspring. Indeed, You are the Hearer of supplication.” (3:37-39)