1) I would replace the ledger fastened to the house. Looks like it was nailed (not to code) and nails are rusting. Wouldn't surprise me if there is damage behind the ledger. Use ledger locks or equivalent, rated for PT.
2) Aluminum is NOT to be used against PT lumber, it will corrode.
3) EDIT:
2x8 joists, sorry for confusion caused by me.
So I would use rubber stick-on flashing behind the new ledger, and on top of the new ledger to protect the aluminum flashing. As to the gap, I would just fill gap on top of the new decking with pvc trim board ripped to fit.
https://www.lowes.com/pd/TITE-SEAL-Self-Adhesive-Waterproof-9-in-x-33-ft-Rubberized-Asphalt-Roll-Flashing/3055549
https://www.lowes.com/pd/FastenMaster-50-Count-0-to-x-5-in-Ecoat-Hex-Drive-Structural-Wood-Screw/3294886