Check if field is of same type as parent when expanding ModelAttribute

To avoid StackOverflowError when expanding ModelAttributes, skip
call to `expand` when a treeish field is encountered. #465