At some early stage in the flight, why will commercial pilots announce the cruising altitude of the flight?
No real reason other than it keeps people from bugging the flight attendants by asking "how high are we??".
It also lets the flight attendants know that the aircraft is at cruise so won't be climbing and making the carts harder for them to push around.
Passengers like information and even if some do not, it isn't much an inconvenience to hear it anyway. That information is a matter of tradition as far as I can tell. It is written nowhere in my manuals what is to be said in the boarding PA except some general guidelines on how to conduct yourself on the PA system. PA announcements you've heard have the cruising altitude, and the captain showing a new first officer how to do the boarding announcement will include that information. That first officer will go on to include the cruise altitude and when he is a captain he'll pass it along to his first officers.
If you took a look at every pilot individually you'll find that the vast majority of each pilots boarding announcements are exactly the same (aside from things that vary like the specific cruise altitude and weather information). After saying the announcement a few times you settle into a routine and it perpetuates.
If it is at the beginning of the flight, I would guess they are just sharing in case any passengers are interested. It may give flight attendants an idea of how long it will take to reach cruise.