You are the one that isn't understanding.
400 feet AGL is 400 feet above ground level.
Unless you are on pancake-flat land, it's not 400 feet above where you took off.
No-one cares where you take off from. It is completely irrelevant.
What is important is how high your Phantom is above the ground below it.
In the example you use, your Phantom is 400 feet above the ground level immediately below it.
No-one cares how high the mountain is above sea level or above the surrounding land.
The height of the mountain is as irrelevant as the location of your take off point.
If you look at the rules pertaining to real planes,(91.119 Minimum Safe Altitudes) in the USA
You'll find they say:
Except when necessary for takeoff or landing, no person may operate an aircraft below the following altitudes:
(c) Over other than congested areas. An altitude of 500 feet above the surface
In your part of the world they say:
it must not fly less than 1000 ft above the highest fixed object within 600m of the aircraft.
Note that they refer to height above the surface or above obstacles .. not above takeoff or sea level.
This is the standard method for aviation to deal with obstacles and a planet that isn't perfectly flat.
It's a simple concept and I won't waste my effort typing any more explanations for you.