You algorithm won't entirely work - you'll have to go back and fix some islands after the fact. Let's say X is land and . is water. Consider this graph
If you go left to right you'll conclude that the Xs in the first row constitute 2 different islands, because they don't yet appear connected. That's why you'd want to do a search.
I think you could use your approach and then go over it again and resolve/merge islands, but it's not as straightforward as you laid out. I haven't thought about it too much but I think just a second pass would be required.
Actually, no, you know what, the 2nd pass would need to do a DFS or BFS to rename all the components that needed renaming. Like consider, with your algorithm after the first pass, you'd have
(or maybe the bottom right would be a 1, but you see what I mean, just depends on how you write it)
You could go through and look for adjacent squares that have different numbers, but as in this case, you'd have to expand to find all the "2"s that needed changing.