In a situation where the pilot realizes that weight of the aircraft is too high, can they dump luggage / cargo mid air, similar to dumping fuel?
No they can't. The cargo doors are secured and will not open mid-flight.
Cargo holds are usually pressurized so opening the door anyway would cause depressurization.
Also if the weight was too high the pilot should never have lifted off in the first place.
Then after you theoretically throw the stuff off board think about what happens after to the stuff. It will drop down hard probably on someone's roof.
Only some military cargo planes with a back hatch are designed to jettison cargo.
There are various examples in history where luggage and/or cargo was dump during flight to reduce weight:
To lose weight, the left overwing exit was opened and luggage of the passengers was jettisoned.
Cargo was jettisoned, but the aircraft continued to lose altitude.
Today? No, not practical... aside from sudden depressurization, the high speed of the aircraft means that anything jettisoned from the aircraft stands a chance of striking tail surfaces with enough force to damage or destroy them.
Same goes for the cargo hold - it is also pressurized, with similar problems on sudden depressurization. Unintended opening of the cargo hold in flight has caused more than one crash, and several emergency landings.
In the early days of commercial aviation, dumping luggage due to low fuel was not unknown. In those days, aircraft were unpressurized, and flew through the weather, not over it. Aircraft speed was low, around 100-150kts, so things could be tossed out without risking damage to the tail. The lack of ILS at airports meant that those airports would close more frequently due to poor visibility. It was possible for an airliner, even with good fuel reserves, to run low on fuel if heavy fog closed all airports within the range of the aircraft. One way to keep the plane in the air longer was to dump luggage to lighten the aircraft.
In his book Fate Is The Hunter, Ernest Gann describes preparing to dump luggage from an ice encrusted DC2 - up to four inches thick in some places on the aircraft. They didn't take that step, but were prepared to.