The limp-mode and "gear can be engaged without pressing brake" are somewhat related.
First the "gear can be engaged without pressing brake" issue:
There are two locking systems on the gear shift lever for 2004-2007 E60s, and the solenoid operated lock is only operational when the engine is running.
The first is a cable linking the ignition lock to the gear shift lever. The key can only be removed when the gear shift lever is in park. Moving the gear shift lever to park also operates a cable connected to the mechatronics transmission to lock the transmission output shaft. Conversely, the gear shift lever can only be moved out of park if the key is inserted and turned to a least the first position.
A second locking system is employed when the car is started and the shift lever is in the P or N position. A solenoid in the transmission mechatronic unit sends a signal to the transmission control module that then sends a voltage to a locking solenoid in the center console to move a solenoid and pin to a locked position, preventing the gear shift lever from being moved. When the brake is depressed the voltage returns to zero and the solenoid/pin retracts.
Either the mechatronics unit is not sending the signal or the TCM (transmission control module) is not forwarding the voltage.
The second issue "limp mode" can be a number of things, including low transmission fluid level, which might also be causing the gear shift locking solenoid to malfunction.
I would check your transmission fluid level first. If you haven't serviced it in a while I would consider a drain and fill. If you do it twice (with maybe 100 miles of driving in between) you will have 85% fresh fluid after both drain and fills. Even though the system holds about 11 quarts when you drain the transmission sump you will only get about 6 quarts out as the rest is held in the torque converter.