MN 36 parallels for section where Buddha as a 9 year old boy has first jhana I read up on B. Analayo's Agama comparative notes between the passage in question in various EBT schools (pali, more than one agama lineage, sanskrit...).

But he didn't have the part I'm interested in. He talks about how one recension talks about Buddha as a boy experiencing all 4 jhanas instead of just first jhana for example. 

Does anyone have quote and references for the passages in question?

In the pali version, all it says is while his father was working, buddha sat down in the cool shade of a tree and spontaneously entered first jhana.

I'm especially interested in one of the Agamas, which says the same thing, but adds that right before he entered jhana, he had been observing the dukkha of watching earthworms getting eaten by birds.
I could find the part about the 4 jhanas instead of only the first jhana, but I could not find the part about the earthworms.
From Ekottarāgama 31.8 of the Taisho Tripitaka:

「爾時，我作 是念：『今日可食一果。』爾時我便食一果。當 我食一果之日，身形萎弱不能自起居，如 年百二十，骨節離散不能扶持。比丘當知，
爾時一果者，如似今日小棗耳。爾時，我復作 是念：『非我成道之本，故當更有餘道。』爾時， 我復作是念：『我自憶昔日，在父王樹下無
婬、無欲，除去惡不善法，遊於初禪；無覺、 無觀，遊於二禪；念清淨無有眾想，遊於 三禪；無復苦樂，意念清淨，遊於四禪。此或
能是道，我今當求此道。』

Using Google Translate, I got:

&quot;At this time, I just said: &quot;I can eat one fruit today.&quot; At this time,
I eat one fruit. When I eat one fruit, I am weak and unable to live by
myself. For example, when I am a hundred and twenty, my joints cannot
be separated. Support. Bhikkhus should know that when there is a
fruit, it is like today's jujube ears. When you are here, I repeat it
by saying: &quot;It is not the foundation of my enlightenment, so I should
have more surplus.&quot; &quot;I recall from the past, under my father’s tree,
there was no lust, no desire, no evil and unwholesome dhammas,
swimming in the first meditation; no awareness, no insight, swimming
in the second meditation; pure mind without many thoughts, swimming in
the third meditation; Resume suffering and happiness, pure mind, swim
in the four meditations. This may be the Tao, I should ask for it
now.&quot;

The Chinese used in the agama is probably a bit different from modern Chinese, so the machine translation may be inaccurate.
Ekottarāgama is the Sanskrit equivalent of the Pali collection of Aṅguttara Nikāya.