Don't bury it. Use the apron concept. The idea is that the digging predator goes up to the fence, tries diggging, hits the wire, and does not know to back up.
Take a strip 18" to 24" wide and lay it flat on the ground outside your coop and run. Attach it at the bottom so nothing can get through. You don't need to bury it at all. Just lay something heavy on it long enough for the grass to grow up through it and hold it down, but it is easier to mow and weed eat if it is buried a bit. Many people take up the sod, which is usually an inch or two, put the wire down, and put the sod back on top. That's a lot easier than digging a trench, especially in rocky ground, and I think it is more effective.
Yes painting will make it last a lot longer.
A lot of us have dug up buried metal, not just hardware cloth. Sometimes it is in great shape and sometimes it is totally shot even though it has been buried the same amount of time.
I tried to say it before but the message obviously did not get through. There are so many differences in our situations that how long it lasts for me does not mean much of anything to you. Different soils, different moisture, different chemical composition of the metal, different gauge of material, different coatings and quality of coatings, and a really big one, whether or not that coating is scratched or damaged. How long it lasts for me has no relationdhip to how long it will last for you.