That is an interesting question.
Step 1, be operating in the basic alphabet.
Step 2, work out the necessary modifiers on top of that.
This is... harder than it looks.
Q: Are there keyboard layouts for Ancient Greek, or for Sanskrit?
A: Yes, e.g.
https://help.keyman.com/keyboard/greekclassical/1.2/greekcla...
http://prakrit.info/keyboard.html
BUT they may already have their own systems for diacritics, as these do.
I note that the Sanskrit one here uses dead keys, which I personally hate.
Second note: dead keys are responsible for the very common issue of Eastern European keyboard users trying to type English on layouts with an acute accent key, and using the accent for an apostrophe. If you know the difference the result looks terrible, especially in any and all proportionally-spaced fonts.
In other words the core (key, haha) problem here is lack of uptake of the Compose key by IBM when designing the PC, so meaning it is not generally known and people design fancy new layouts because they don't know this is an option.