Backport "Modules can't be marked as deprecated"

Original D2 commit : 2af112ec0f156c19b63a9d8269b37ba0555c5857
"fix Issue 12567 - Modules can't be marked as deprecated "
Merge pull request #3976 from mihails-strasuns-sociomantic/d1-deprecated-modules

[D1] backport "Modules can't be marked as deprecated"