'stream' is a general resource type and can have specific subtypes (imap, pop, curl ...). Casting from 'stream' to them makes sense alright.
E.g. Making OAUTH2 work for imap, but still use the normal imap_ functions. Just open a ssl:// stream to the IMAP server with stream_socket_client(), send the "AUTHENTICATE XOAUTH2 ..." authentication with valid token and then use the imap_ functions on the casted 'stream' to 'imap' resource.
Not being able to cast from 'stream' to 'imap' makes it necessary to use 3rd party solutions, like php-imap. Doesn't have to be necessary, if the cast would be possible.