The problem with the marathon is that there are a lot of "small" things that could go wrong that have a big negative impact, sometimes derailing your entire race. I've experienced this firsthand. Some are fixable and others are out of your control.
1. Training. Looks like you trained well with milage, consistency, tune-up races, etc. The only red flag I see is the 25-mile run 3 weeks out. That may have been overdoing it a bit as 20-23 miles is optimal for most runners unless you are very experienced. I'm assuming you followed a taper, but you didn't mention that.
2. Weather. This is something that has messed me up in the past...especially on a warm/hot day. Sometimes a slight pace adjustment is needed due to weather and if no adjustments are made, that can affect the latter half of the marathon.
3. Race week Hydration/Nutrition. Although it may seem minor making sure you are eating/hydrating a lot the week leading into a race is important. Getting adequate sleep in the days leading up is good as well.
4. Time off feet. The day or two before a race it's important to reduce your standing time as much as possible. My last marathon was boston and I made the mistake of standing/walking around the city and expo for half a day. I had quad and hamstring cramps very early in the race the following day. This may not have had that much affect, but I would try to relax as much as you can and advise not standing around a ton the day before. Also I didn't stretch before the race so I would make sure your loose before you line up.
The marathon is unforgiving, and it's hard for everything to line up perfectly so I understand your frustration. But when it does work out that's what really makes it special. Stick with it! Based on your half marathon time, you definitely have the potential to run faster.