The federal and Northern Territory governments have announced a $4 billion funding agreement to build thousands of homes in remote communities over the next decade.