Why won't you allow someone into the cockpit while on ground?
I don't agree with the strict enforcement of this rule by the DGCA (but I'm not an airline pilot so I think my opinion doesn't really count on this matter). But there is logic behind the ban - many safety-critical actions are completed before the plane has left the gate. Such actions include calculating takeoff speeds, briefing the departure procedures, and completing various checklists.

Having people in the cockpit could prove to be a big distraction when trying to complete these tasks, particularly when the time is limited anyway such as on a short turnaround. 

Making a mistake before leaving the gate can definitely end in disaster. Take Emirates flight 407 in 2009. The crew entered an incorrect takeoff weight into the system. As a result there wasn't enough thrust to rotate and the A340 barely cleared the airport fence.