I am not sure what you want and what your problem is. Can you specify it a little bit?
I have an Indesign Document. I want the first page to have a green background, and the last page a red background. My idea was to have the rest of the pages to have a background colour that transform from green through yellow all the way until the last page in red. I can do it manually but if i ever want to add more pages I would have to rearrange the colors all over again.
In the image below my pages layout in photoshop.
You have to add a background—if different—to each spread separately. You can use an object style which is changed a little bit on each spread.
If you had 10 pages or fewer, you could use spread pages, with the background image spanning all 10 pages.
For more than 10 pages, you can create a multi artboard Illustrator file, with the gradation spanning all artboards, save the Illustrator file as a multipage PDF (including bleed), then place the multipage PDF into InDesign (use the place multipage script). Save this as a separate InDesign file.
When you are finished making edits to your original InDesign file, make a new layer called Background and lock the other layers. With both documents open and viewable, drag and drop the background pages from one document to the other (one at a time).
You are limited to a 227" maximum canvas size in Illustrator, but you can get around that by creating the background PDF at half size, or making multiple gradations. If the page count changes, you will need to re-create and re-place the background pages.
It's not exactly what you want, but hopefully a bit faster than moving the background for each page.