Example.com is certainly acceptable as well but it does have a somewhat negative side effect of being an actual running, pinging, sometimes-service-responding host which means if people paste the documentation verbatim it may either actual execute or take longer than normal to timeout (ssh would fall into the latter). ".example" is reserved for the same purpose but does not have any registered domains, on top of being a few characters shorter for when you need more than 1 name in your documentation.
I think in the context of SSH, use of subdomains is very common and to be expected.
As far as laypersons are concerned, I would worry that they wouldn’t recognize foo.example to be a domain name, as opposed to www.example.com or blog.example.com.