If you are flying BRI-MUC-MAD the flights are like domestic flights in the US. BRI-MUC will be on Air Dolomiti’s ERJ195 and you may have to take a bus to the terminal but once in the terminal you can simply walk to your departure gate for the MAD flight without going through security or passport control.
However if you have overlapping reservations on two LH flights, MUC-IAD and MUC-MAD and they detect the duplication, they may cancel one or both reservations. I suggest you book MUC-MAD on IB. You will have to change terminals which MIGHT require security check but I cannot see you will encounter any problem.
Double booking [and dupe check] on Lufthansa