No, of course not. But PM is different from the DM. Yes the PM outranks the DM and is the ultmate head of govt and therefore also has jurisdiction over the defence ministry, but that is only one part of his job. Basically the PM's job is to oversee the functioning of the entire govt, including the textiles and fisheries ministries. An ex military man as PM won't hold as much power to influence the defence ministry as a defence minister would.
I'm not saying it should be illegal, just that it would be a bad idea. And your point of appointing an ex military chief as the DM was precisely because of his military background, and not in spite of it, right? That is why your assertion that he would be a civilian for all practical purposes sounds unconvincing. Yes, technically he would be a civilian, but his military background will definitely influence his performance, which is why you recommend the idea in the first place, and it is for the same reason that I don't recommend it.