I own an AR and make silencers as a hobby. What you suggest is legal. I would not do it though. I would rather be able to attach the silencer to other rifles too. Cleaning the silencer will probably not be a problem, my AR can is sealed and works just fine. The only problem may be the barrel crown, it will get very dirty after a while especially if you can not clean it.
If you need something in 223 and very compact, then get an AR pistol and put a detactable can on it. Not as good as a real carbine or SBR in a defense situation, but it is an option.
Ranb