Of course they could be, but simpler is more desireable.
Can’t jam a bullet or a shell, especially if you have mechanical firing still available.And optical sughts.
I agree that missiles have become increasingly expensive, many times more costly than a deck gun can shoot.
I note the UK’s Navy test-fired one of their own from a submarine but limits testing to every four or more years. Each shot cost $17 million....