json – Dynamically update JSONB rows – POSTGRESQL

Im currently trying to update some jsonb fields that we have on our db, we are moving nodes from the json a level up for an specific field.
This node we are trying to move, however, is not fixed, sometimes its index can be 1, 2, or 3.

I currently have this query:

 UPDATE table1 t1 SET jsonbfield = jsonb_set(jsonfield ,
            '{field1,0,field2,0,configuration}',
            (select jsonbfield->'field1'->0->'field2'->0->'field3'->0->'configuration'
            from table1 where
            jsonbfield->'field1'->0->'field2'->0->'field3'->0->>'name'='SOME_NAME'
            and id=t1.id), true)
            where jsonbfield->'field'->0->'field2'->0->'field3'->0->>'name'='SOME_NAME';

Which basically would achieve the requirement if the node we were trying to move was always at position 0, however, as mentioned, we noticed that the node we want to move up can be on another positon.

is there a way to iterate trough each row json, get the position of the node we want to move, save it into a variable and place it in the update statement?

i have tried with a do for, but it seems it doesnt interact well with select jsonb_array_elements.

Thanks beforehand