Prevent adding/setting parent component as child (#12720).

Change-Id: I9b7b43f176e88d9edca591001297b94475a31854